Está en la página 1de 16

Date

daLe opLlons
a locale's abbrevlaLed weekday name (eg Sun)
A locale's full weekday name (eg Sunday)
b locale's abbrevlaLed monLh name (eg !an)
8 locale's full monLh name (eg !anuary)
c locale's daLe and Llme (eg 1hu Mar 3 230323 2003)
C cenLury llke ? excepL omlL lasL Lwo dlglLs (eg 21)
d day of monLh (eg 01)
u daLe same as m/d/y
e day of monLh space padded same as _d
l full daLe same as ?md
g lasL Lwo dlglLs of year of lSC week number (see C)
C year of lSC week number (see v) normally useful only wlLh v
h same as b
P hour (0023)
l hour (0112)
[ day of year (001366)
k hour ( 023)
l hour ( 112)
m monLh (0112)
M mlnuLe (0039)
8 24hour hour and mlnuLe same as PM
s seconds slnce 19700101 000000 u1C
S second (0060)
1 Llme same as PMS
u day of week (17) 1 ls Monday
w day of week (06) 0 ls Sunday
x locale's daLe represenLaLlon (eg 12/31/99)
x locale's Llme represenLaLlon (eg 231348)
y lasL Lwo dlglLs of year (0099)
? year


Ca|

LlsL all flles
|s
opLlons
ls a shows hldden flles also
ls l shows lnode of flle/dlr
ls l long llsLlng
ls le exLended llsLlng wlLh seconds and year
ls lh human readable formaL
ls lrL sorL by Llme
ls 8 recurslve llsLlng
sorL Lhe flles ln lncreaslng order of Lhe flle slze
ls l | sorL n +4
ls *09*
show flles and dlrecLory conLalnlng
numbers

hlsLory
!! repeaLs Lhe prevlous command
!parLlal lasL command execuLed
!no
wc l (llne counL )
pwd (Lo know presenL worklng dlrecLory)
chmod (change permlsslon /acls)
chgrp (change group name Lo belog)
chown (change owner of Lhe flle/dlr)
caL caL n (Lo vlew Lhe flle conLenLs)
more (Lo vlew Lhe flle conLenLs)
less (Lo vlew Lhe flle conLenLs reverse from boLLom Lo Lop)
head (Lo vlew Lhe flle conLenLs reverse from Lop Lo boLLom)
Lall (Lo vlew lower secLlon of Lhe flle)
8Lul8LC1S
SLd ouL sLd err
1ee
who | tee users.file
condron ttyp0 Apr 22 14:10 (lcondron-pc.acs.)
frank ttyp1 Apr 22 16:19 (nyssa)
condron ttyp9 Apr 22 15:52 (lcondron-mac.acs)
rm (deleLe flle CnL? provlded rwx permlsslon)
rmdlr (deleLe dlrecLory provlded rwx permlsslon)
cp cp r (copy Lhe flle or recurslvely all Lhe flles from a dlrecLory Lo Lhe LargeL locaLlon)
mv mv r (copy Lhe flle or recurslvely all Lhe flles from a dlrecLory Lo Lhe LargeL locaLlon doesn'L
reLaln a copy)

bunzip2 file1.bz2 decompress a file called 'file1.bz2'
bzip2 file1 compress a file called 'file1'
gunzip file1.gz decompress a file called 'file1.gz'
gzip file1 compress a file called 'file1'
gzip -9 file1 compress with maximum compression
rar a file1.rar test_file create an archive rar called 'file1.rar'
rar a file1.rar file1 file2 dir1
compress 'file1', 'file2' and 'dir1'
simultaneously
rar x file1.rar decompress rar archive
unrar x file1.rar decompress rar archive
tar -cvf archive.tar file1 create a uncompressed tarball
tar -cvf archive.tar file1 file2 dir1
create an archive containing 'file1', 'file2'
and 'dir1'
tar -tf archive.tar show contents of an archive
tar -xvf archive.tar extract a tarball
tar -xvf archive.tar -C /tmp extract a tarball into / tmp
tar -cvfj archive.tar.bz2 dir1 create a tarball compressed into bzip2
tar -xvfj archive.tar.bz2
decompress a compressed tar archive in
bzip2
tar -cvfz archive.tar.gz dir1 create a tarball compressed into gzip
tar -xvfz archive.tar.gz
decompress a compressed tar archive in
gzip
zip file1.zip file1 create an archive compressed in zip
zip -r file1.zip file1 file2 dir1
compress in zip several files and directories
simultaneously
unzip file1.zip decompress a zip archive
touch -t 0712250000 file1
modify timestamp of a file or directory -
(YYMMDDhhmm)

Lr
echo 8aghav | Lr lower upper
8ACPAv

echo 8ACPAv | Lr upper lower
raghav


paste file1 file2 merging contents of two files for columns
paste -d '+' file1 file2
merging contents of two files for columns
with '+' delimiter on the center
sort file1 file2 sort contents of two files
sort file1 file2 | uniq
sort contents of two files omitting lines
repeated
sort file1 file2 | uniq -u
sort contents of two files by viewing only
unique line
sort file1 file2 | uniq -d
sort contents of two files by viewing only
duplicate line
comm -1 file1 file2
compare contents of two files by deleting
only unique lines from 'file1'
comm -2 file1 file2
compare contents of two files by deleting
only unique lines from 'file2'
comm -3 file1 file2
compare contents of two files by deleting
only the lines that appear on both files

optos
Lxamples

LlsL all fllenames endlng ln mp3 searchlng ln Lhe currenL folder and all subfolders
$ flnd name *mp3

LlsL all fllenames endlng ln mp3 searchlng ln Lhe muslc folder and subfolders
$ flnd /muslc name *mp3

LlsL flles wlLh Lhe exacL name Sales_documenLdoc ln /work and subfolders
$ flnd /work name Sales_documenLdoc

LlsL all flles LhaL belong Lo Lhe user Maude
$ flnd user Maude

LlsL all Lhe dlrecLory and subdlrecLory names
$ flnd Lype d

LlsL all flles ln Lhose subdlrecLorles (buL noL Lhe dlrecLory names)
$ flnd Lype f

LlsL all Lhe flle llnks
$ flnd Lype l

LlsL all flles (and subdlrecLorles) ln your home dlrecLory
$ flnd $PCML

llnd flles LhaL are over a glgabyLe ln slze
$ flnd /Movles slze +1024M

llnd flles have been modlfled wlLhln Lhe lasL day
$ flnd /Movles mLlme 1

llnd flles have been modlfled wlLhln Lhe lasL 30 mlnuLes
$ flnd /Movles mmln 30

llnd doc flles LhaL also sLarL wlLh quesLlonnalre (Anu)
$ flnd name *doc name quesLlonnalre*

LlsL all flles beglnnlng wlLh memo and owned by Maude (Anu)
$ flnd name memo* user Maude

llnd doc flles LhaL do nC1 sLarL wlLh AccounLs (nC1)
$ flnd name *doc ! name AccounLs*

llnd flles named secreLs ln or below Lhe dlrecLory /Lmp and deleLe Lhem noLe LhaL Lhls wlll work
lncorrecLly lf Lhere are any fllenames conLalnlng newllnes slngle or double quoLes or spaces
$ flnd /Lmp name secreLs Lype f prlnL | xargs /bln/rm f

llnd flles named secreLs ln or below Lhe dlrecLory /Lmp and deleLe Lhem processlng fllenames ln
such a way LhaL flle or dlrecLory names conLalnlng slngle or double quoLes spaces or newllnes are
correcLly handled 1he name LesL comes before Lhe Lype LesL ln order Lo avold havlng Lo call sLaL(2)
on every flle
$ flnd /Lmp name secreLs Lype f prlnL0 | xargs 0 /bln/rm f

8un myapp on every flle ln or below Lhe currenL dlrecLory noLlce LhaL Lhe braces are enclosed ln
slngle quoLe marks Lo proLecL Lhem from lnLerpreLaLlon as shell scrlpL puncLuaLlon 1he semlcolon ls
slmllarly proLecLed by Lhe use of a backslash Lhough could have been used ln LhaL case also

flnd Lype f exec myapp

1raverse Lhe fllesysLem [usL once llsLlng seLuld flles and dlrecLorles lnLo /rooL/suldLxL and large flles
lnLo /rooL/blgLxL

flnd / ( perm 4000 fprlnLf /rooL/suldLxL #m u pn )
( slze +100M fprlnLf /rooL/blgLxL 10s pn )

Search for flles ln your home dlrecLory whlch have been modlfled ln Lhe lasL LwenLyfour hours 1hls
command works Lhls way because Lhe Llme slnce each flle was lasL modlfled ls dlvlded by 24 hours
and any remalnder ls dlscarded 1haL means LhaL Lo maLch mLlme 0 a flle wlll have Lo have a
modlflcaLlon ln Lhe pasL whlch ls less Lhan 24 hours ago

flnd $PCML mLlme 0

Search for flles whlch have read and wrlLe permlsslon for Lhelr owner and group buL whlch oLher
users can read buL noL wrlLe Lo (664) llles whlch meeL Lhese crlLerla buL have oLher permlsslons blLs
seL (for example lf someone can execuLe Lhe flle) wlll noL be maLched

flnd perm 664

Search for flles whlch have read and wrlLe permlsslon for Lhelr owner and group and whlch oLher
users can read wlLhouL regard Lo Lhe presence of any exLra permlsslon blLs (for example Lhe
execuLable blL) 1hls wlll maLch a flle whlch has mode 0777 for example

flnd perm 664

Search for flles whlch are wrlLable by somebody (Lhelr owner or Lhelr group or anybody else)

flnd perm /222

All Lhree of Lhese commands do Lhe same Lhlng buL Lhe flrsL one uses Lhe ocLal represenLaLlon of
Lhe flle mode and Lhe oLher Lwo use Lhe symbollc form 1hese commands all search for flles whlch
are wrlLable by elLher Lhelr owner or Lhelr group 1he flles donL have Lo be wrlLable by boLh Lhe
owner and group Lo be maLched elLher wlll do

flnd perm /220
flnd perm /u+wg+w
flnd perm /uwgw

8oLh Lhese commands do Lhe same Lhlng search for flles whlch are wrlLable by boLh Lhelr owner and
Lhelr group

flnd perm 220
flnd perm g+wu+w

1hese Lwo commands boLh search for flles LhaL are readable for everybody (perm 444 or perm
a+r) have aL leasL on wrlLe blL seL (perm /222 or perm /a+w) buL are noL execuLable for anybody (!
perm /111 and ! perm /a+x respecLlvely)

flnd perm 444 perm /222 ! perm /111
flnd perm a+r perm /a+w ! perm /a+x



rep string fiIe $earches input file(s) for specified strin
and prints the line with matches
rep mike Ietter $earches for the strin mike in the file
named Ietter and prints any line with
mike in it to the screen
rep -c string fiIe $earches and prints only the number of
matches to the screen
rep -c hayes bankIetter $earches the file bankIetter for the
strin hayes and prints the number of
matches to the screen
rep -i string fiIe $earches without reard to letter case rep -i hi fiIe1 $earches fiIe1 for hi, Hi, hI,
and HI
and prints all matches to the screen
rep -n string fiIe Prints to the screen preceded by the line
number
rep -n abc aIpha $earches aIpha for abc and prints the
matches' lines and line numbers to the
screen
rep -v string fiIe All lines that do not match are printed rep -v Iead penciIs Prints all lines in
penciIs that /4349
contain the strin Iead
rep -x string fiIe Only exact matches are printed rep -x time meetings Prints only lines in
meetings that
match time exactly
rep is useful when you use it in a | "pipe ps -ef | rep bob Finds all processes in full listin and
then prints only the ones that match
the strin bob to the screen
You can also redirect its output to a
file.
rep -i jan b_days>mymonth $earches the file b_days for caseinsensitive
matches to jan and places
the matchin





























aghavea w|| cote fom hee

System e|ate Commas
losLaL (Lo vlew l/o sLaLlsLlcs of Lhe sysLem opLlonal 8M)
rsLaL (Lo reporL acLlve process sLaLlsLlcs opLlonal 8M)
vmsLaL (Lo reporL vlrLual memory sLaLlsLlcs)
flnger (Lo dlsplay lnformaLlon abouL local and remoLe users)
Lop (Lo dlsplay sysLem sLaLlsLlcs wrL user and processes opLlonal 8M)
ps (llsLs all Lhe process deLalls)
klll (Lo klll a ref process only)
neLsLaL (Lo show neLwork sLaLlsLlcs)
hosLname
who -a
show who is logged on, and print: time of
last system boot, dead processes, system
login processes, active processes spawned
by init, current runlevel, last system clock
change

w (Lo dlsplay lnformaLlon abouL currenLly loggedln users)
whlch (locaLe a command dlsplay lLs paLhname or allas)
users (Lo dlsplay a compacL llsL of users logged ln)
Arch show architecture of machine(1)
uname -m show architecture of machine(2)
uname -r show used kernel version
ld ld a
groups

fLp
LelneL
scp
ssh


du
df
free
swap
prLdlag
cotab
bg
fg


ps: displays current process status
To list all your processes, enter:
ps

To list all processes, enter:
ps aux
uname: displays information about the operating system
uname -amnrsv,

-a Displays all information specified with the -m, -n, -r, -s, and -v
options.

-m Displays the type of hardware running the system.

-n Displays the name of the node (this may be a name that the system is
known by to a communications network).

-r Displays the release number of the operating system.

-s Displays the name of the implementation of the operating system.
(This
option is on by default.)

-v Displays the operating system version.

kill: sends a signal to a running process
To kill a process with process id 21234
$ kill -KILL 21234

To stop a process with process id 21234
$ kill -STJP 21234

To resume a stopped process with process id 21234
$ kill -CJNT 21234
strings: Finds strings in an ASCII or binary file
Used with non text files, such as object and executable files, prints
out all the
strings oconsisting of at least 4 consecutive printable characters found
in the
file.

strings -ao, -n number, file...,
-a Searches an entire object file, rather than just the initialized data
space.

-n number
Sets the minimum string length to number rather than the default of
4.

-o Precedes each string by its offset (in octal) in the file.
file: determine the kind of a file
file filename
Determines what kind of file filename is, if binary, text, if object
file, if source
in Java ..
strace: print information on system calls made and signals received by a
program
strace command
It executes the command printing out information about all the system
calls it makes and
signals it receives. With qualifiers you can obtain also information
about the time taken
in the calls and between the calls.
For example
strace -c a.out
prints information and timing statistics for the program a.out
ipcs: displays Interprocess Communication (IPC) facility status
ipcs -a|-bcopt, -mqs,
where
-a Same as specifying the -b, -c, -o, -p, and -t options.

-b Writes the maximum number of bytes in message queues, the size of
seg-
ments for shared memory, and the number of semaphores in each
semaphore
set.

-c Writes the username and group name of the user that made the
facility.

-m Writes information about active shared memory segments.

-o Writes the following usage information:
Number of messages on queue
Total number of bytes in message queues
Number of processes attached to shared memory segments

-p Writes the Process number of last process to attach or detach on
shared memory segments

-q Writes information about active message queues.

-s Writes information about active semaphore set.

-t Writes the following:
Time of the last control operation that changed the access permis-
sions for all facilities
Time of the last msgsnd() and last msgrcv() on message queues
Time of the last semop() on semaphore sets
ipcrm: removes message queue, semaphore set, or shared memory identifiers
ipcrm -m shared_memory, -M shared_memory_key, -q message_queue, -Q
message_key, -s semaphore_ID, -S semaphore_key,
where:
-m shared_memory
Removes the shared memory identifier shared_memory. The shared memory
segment and data structure associated with shared_memory are also
removed after the last detach operation.

-M shared_memory_key
Removes the shared memory identifier, created with key
shared_memory_key. The shared memory segment and data structure
associ-
ated with it are also removed after the last detach.

-q message_queue
Removes the message queue identifier message_queue and the message
queue and data structure associated with it.

-Q message_key
Removes the message queue identifier, created with key message_key,
and
the message queue and data structure associated with it.

-s semaphore_ID
Removes the semaphore identifier semaphore_ID and the set of
semaphores
and data structure associated with it.

-S semaphore_key
Removes the semaphore identifier, created with key semaphore_key, and
the set of semaphores and data structure associated with it.
netstat: displays network statistics
To produce the default display for network connections, enter:
netstat

To show the state of the configured interfaces, enter:
$ netstat -i

To show the routing tables, enter:
$ netstat -r

To show the routing tables with network addresses, enter:
$ netstat -rn

ifconfig: configures or displays network interface parameters
To show information about all interfaces, enter:
$ ifconfig -a

To query the status of serial line interface sl0, enter:
$ ifconfig sl0
nslookup: queries Internet name servers interactively
To find the dotted decimal IP address of host name
snowhite.cis.temple.edu
$ nslookup snowhite.cis.temple.edu

To find the hostname of the dotted decimal IP address 155.247.190.207
$ nslookup 155.247.190.207
ping: Sends ICMP ECHO_REQUEST packets to network hosts
To determine the status of host www.cs.stanford.edu:
$ ping www.cs.stanford.edu

To also have a record of the route to www.cs.stanford.edu:
$ ping -R www.cs.stanford.edu
traceroute: Print the route that packets take to the network host
To find the route to host rtfm.mit.edu, enter:
$ traceroute rtfm.mit.edu
arp:Displays and controls Address Resolution Protocol (ARP) tables
To display all current ARP entries:
$ arp -a
lsof: list information about files opened by processes
This is a complex command not available on all unix (you can obtain a copy Irom
Itp://vic.cc.purdue.edu/pub/tools/lsoI/).
To list all open files, use:
lsof

To list all open Internet, x.25 (HP-UX), and UNIX domain files, use:
lsof -i -U

To list all files using any protocol on any port of
snowhite.cis.temple.edu, use:
lsof -i @snowhite.cis.temple.edu

To find the process that has /u/abe/foo open, use:
lsof /u/abe/foo

To find any open file, including an open UNIX domain socket file, with
the
name /dev/log, use:
lsof /dev/log

To obtain PID and command name field output for each process, file
descrip-
tor, file device number, and file inode number for each file of each pro-
cess, use:
lsof -FpcfDi

To find an IP version 4 socket file by its associated numeric dot-form
address, use:
lsof -i@128.210.15.17
iostat: display I/O statistics
iostat drive..., interval, count,
For example
iostat 1 5
displays 5 status reports taken at 1 second intervals.
vmstat: displays virtual memory statistics
vmstat interval count,
vmstat -f|-M|-P|-s,
where:
-f Displays only statistics about the number of forks since system
startup
(see the fork() call).
-P Displays accumulated statistics about physical memory use.
-s Displays accumulated statistics along with the page size.
df: Displays statistics on free disk space
du:Displays a summary of disk usage
To display the disk usage of a directory tree and each of its sub-
trees, enter:
$ du /u/fran

To display the disk usage of each file, enter:
$ du -a /u/fran

To display only the total disk usage of a directory tree, enter:
$ du -rs /u/fran
2. Crontab Commands
export ED!TOR=vi ,to specify a editor to open crontab file.
crontab e Edit your crontab file, or create one if it doesn't already exist.
crontab l Display your crontab file.
crontab r Remove your crontab file.
crontab v Display the last time you edited your crontab file. (This option is only available on a few systems.)
3. Crontab file
Crontab syntax :
A crontab file has five fields for specifying day , date and time followed by the command to be run at that
interval.
command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6)
(Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
in the value field above means all legal values as in braces for that column.
The value column can have a or a list of elements separated by commas. An element is either a number in the
ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).
!otes
A. ) Repeat pattern like /2 for every 2 minutes or /10 for every 10 minutes is not supported by all operating
systems. !f you try to use it and crontab complains it is probably not supported.
B.) The specification of days can be made in two fields: month day and weekday. !f both are specified in an
entry, they are cumulative meaning both of the entries will get executed .
4. Crontab Example
A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PN.
18 * * * rm /home/someuser/tmp/*
















|e coto check
flle check condlLlons
Pere are a few useful condlLlons


b flle 1rue lf Lhe flle exlsLs and ls block speclal flle
c flle 1rue lf Lhe flle exlsLs and ls characLer speclal flle
d flle 1rue lf Lhe flle exlsLs and ls a dlrecLory
e flle 1rue lf Lhe flle exlsLs
f flle 1rue lf Lhe flle exlsLs and ls a regular flle
g flle 1rue lf Lhe flle exlsLs and Lhe seLgroupld blL ls seL
k flle 1rue lf Lhe flles sLlcky blL ls seL
L flle 1rue lf Lhe flle exlsLs and ls a symbollc llnk
p flle 1rue lf Lhe flle exlsLs and ls a named plpe
r flle 1rue lf Lhe flle exlsLs and ls readable
s flle 1rue lf Lhe flle exlsLs and lLs slze ls greaLer Lhan zero
s flle 1rue lf Lhe flle exlsLs and ls a sockeL
L fd 1rue lf Lhe flle descrlpLor ls opened on a Lermlnal
u flle 1rue lf Lhe flle exlsLs and lLs seLuserld blL ls seL
w flle 1rue lf Lhe flle exlsLs and ls wrlLable
x flle 1rue lf Lhe flle exlsLs and ls execuLable
C flle 1rue lf Lhe flle exlsLs and ls owned by Lhe effecLlve user ld
C flle 1rue lf Lhe flle exlsLs and ls owned by Lhe effecLlve group ld
flle1 nL flle2 1rue lf flle1 ls newer by modlflcaLlon daLe Lhan flle2
flle1 oL flle2 1rue lf flle1 ls older Lhan flle2
flle1 ef flle2 1rue lf flle1 and flle2 have Lhe same devlce and lnode numbers
z sLrlng 1rue lf Lhe lengLh of Lhe sLrlng ls 0
n sLrlng 1rue lf Lhe lengLh of Lhe sLrlng ls nonzero
sLrlng1 sLrlng2 1rue lf Lhe sLrlngs are equal
sLrlng1 ! sLrlng2 1rue lf Lhe sLrlngs are noL equal
!expr 1rue lf Lhe expr evaluaLes Lo false
expr1 a expr2 1rue lf boLh expr1 and expr2 are Lrue
expr1 o expr2 1rue ls elLher expr1 or expr2 ls Lrue


SLD
Lo remove lasL 4 characLers of Lhe sLrlng
sed s/$//

bash300$ echo 8aghavendra1hls | sed s/$//
8aghavendra
bash300$ echo 8aghavendra1hl | sed s/$//
8aghavendra

1o remove flrsL 2 chracLers
caL lnpuL_flle | sed s/// ouLpuL_flle



Some Speca| Commas
1o show dlrecLory Lree
flnd Lype d prlnL 2/dev/null|awk !/$/ for (l1lnll++)dlengLh($l)lf ( d 3 l ! 1
)d3prlnLf(ds|)prlnL $nl lS/

Lo prlnL 10 llnes above/below Lhe deflned sLrlng
awk /1C1AL/c30nexLc0 lLAn8uAS1A1SuAlL?uL1AlL_00 |sed / *$/d



ScrlpLlng useful synLax
echo n assword

sLLy echo
read password
sLLy echo

echo # force a carrlage reLurn Lo be ouLpuL
echo ?ou enLered $password


9L oe |es

flnd ! and replace wlLh space
perl pl e s/!/ /g S?S8ln1S1L0012
1 day
$ perl e prlnL scalar localLlme (Llme 1 * 86400)n
1hu Aug 12 140333 2004

13 days
$ perl e prlnL scalar localLlme (Llme 13 * 86400)n
SaL !ul 31 140401 2004

yesLerday
$ perl e prlnL scalar localLlme (Llme 1 * 86400)n | awk prlnL $2$3
Aug12

Lomorrow
$ perl e prlnL scalar localLlme (Llme +1 * 86400)n | awk prlnL $2$3
Aug14


Code Listin 2: File size sum
ls -lAF | perl -e 'while (<>) { next if /^dt/; $sum += (split)[4] } print "$sum\n"'


double space
perl pe $n

triple space
perl pe $nn

umber all lines in a file.
perl -pe '$_ = "$. $_"'
Print the number of empty lines in a file.
perl -lne '$a++ if /^$/; END ,print $a+0,'

enerate random alphanumerical string (password generator)
perl -le'print map , (a..z,A..Z,0..9)rand 62, , 0..pop' 7

8andom no generaLor
perl le srand() prlnL rand for 1

!rint the lines in 'file.txt' that have the string 'for' repeated exactly 3 times:
perl -ne 'print if ( ( () = /for/g ) == 3 )' file.txt

to print from 'file.txt' only the lines 10 to 20:
perl -ne 'print if 10..20' file.txt


Align all text flush right on a 79-column width.
awk ', printf "%79s\n", $0 ,'

Swap first field with second on every line.
awk ', temp = $1; $1 = $2; $2 = temp; print ,'

También podría gustarte