Sunteți pe pagina 1din 9

16-03-2010

More File Operation Commands


split
To split a file into pieces
Output will be the fixed-size pieces of INPUT to
PREFIXaa, PREFIXab, ...
Default size is 1000 lines, and default PREFIX is `x'
With no INPUT, or when INPUT is -, read standard
input
Syntax:
split [OPTION] [INPUT [PREFIX]]
split (Contd.)
Options:
-a, --suffix-length=N
use suffixes of length N (default 2)
-b, --bytes=SIZE
put SIZE bytes per output file
-C, --line-bytes=SIZE
put at most SIZE bytes of lines per output file
-d, --numeric-suffixes
use numeric suffixes instead of alphabetic
-l, --lines=NUMBER
put NUMBER lines per output file
sort
sort command can be used to sort lines of text
files
Syntax:
sort [OPTION]... [FILE]...
By default, it displays the sorted file contents on
standard output
To create a new sorted file from an existing file,
the standard output can be redirected to a new
file
sort (Contd.)
Some important options are:
-d, --dictionary-order
consider only blanks and alphanumeric characters
-f, --ignore-case
fold lower case to upper case characters
-M, --month-sort
compare (unknown) < `JAN' < ... < `DEC
-r, --reverse
reverse the result of comparisons
-n, --numeric-sort
compare according to string numerical value
lpr
lpr uses a spooling daemon to print the named
files when facilities become available; if no
names appear, the standard input is assumed
Syntax:
lpr [ -E ] [ -H server[:port] ] [ -U
username ] [ -P destina- tion[/instance] ]
[ -# num-copies [ -h ] [ -l ] [ -m ] [ -o
option[=value] ] [ -p] [ -q ] [ -r ] [ -
C/J/T title ] [ file(s) ]
lpr (Contd.)
Some important options are:
-P destination[/instance] Prints files to the named
printer
-q Hold job for printing
-r Specifies that the named print files should be
deleted after printing them
# copies Sets the number of copies to print from 1 to
100
-E Forces encryption when connecting to the server
-U username Specifies an alternate username
tr
Translate, squeeze, and/or delete characters from
standard input, writ- ing to standard output
Syntax:
tr [OPTION]... SET1 [SET2]
Input characters in set1 are mapped to
corresponding characters in set2
If length is unequal then set2 is extended to the
length of set1 by repeating its last character as
necessary
Excess characters in set2 are ignored. The set can
be specified directly or as a complement
tr (Contd.)
Some important options are:
c, -C, --complement
first complement SET1
-d, --delete
delete characters in SET1, do not translate
-s, --squeeze-repeats
replace each input sequence of a repeated character that
is listed in SET1 with a single occurrence of that character
-t, --truncate-set1
first truncate SET1 to length of SET2
--version
output version information and exit

S-ar putea să vă placă și