Comanda sort

Aici se discută despre toate distribuțiile de Linux / *nix.

Comanda sort

Postby Zatarra » 25 May 2010, 16:53

Mi-am adus aminte de momentele in care cautam disperat dupa un program care sa faca ceea ce linux-ul face printr-o simpla comanda, si anume sa sorteze linile dintr-un fisier in ordine alfabetica, stergand linile care se repeta (duplicate).
Comanda despre care vorbesc este sort, iar in cazul meu sort input.txt |uniq -> output.txt .

Mai jos veti gasi lista completa cu toate argumentele posibile legate despre aceasta comanda:

dannyboy@dannyboy-laptop:~$ sort --help
Usage: sort [OPTION]... [FILE]...
  or:  sort [OPTION]... --files0-from=F
Write sorted concatenation of all FILE(s) to standard output.
 
Mandatory arguments to long options are mandatory for short options too.
Ordering options:
 
  -b, --ignore-leading-blanks  ignore leading blanks
  -d, --dictionary-order      consider only blanks and alphanumeric characters
  -f, --ignore-case           fold lower case to upper case characters
  -g, --general-numeric-sort  compare according to general numerical value
  -i, --ignore-nonprinting    consider only printable characters
  -M, --month-sort            compare (unknown) < `JAN' < ... < `DEC'
  -n, --numeric-sort          compare according to string numerical value
  -R, --random-sort           sort by random hash of keys
      --random-source=FILE    get random bytes from FILE
  -r, --reverse               reverse the result of comparisons
      --sort=WORD             sort according to WORD:
                                general-numeric -g, month -M, numeric -n,
                                random -R, version -V
  -V, --version-sort          natural sort of (version) numbers within text
 
Other options:
 
      --batch-size=NMERGE   merge at most NMERGE inputs at once;
                            for more use temp files
  -c, --check, --check=diagnose-first  check for sorted input; do not sort
  -C, --check=quiet, --check=silent  like -c, but do not report first bad line
      --compress-program=PROG  compress temporaries with PROG;
                              decompress them with PROG -d
      --files0-from=F       read input from the files specified by
                            NUL-terminated names in file F;
                            If F is - then read names from standard input
  -k, --key=POS1[,POS2]     start a key at POS1 (origin 1), end it at POS2
                            (default end of line)
  -m, --merge               merge already sorted files; do not sort
  -o, --output=FILE         write result to FILE instead of standard output
  -s, --stable              stabilize sort by disabling last-resort comparison
  -S, --buffer-size=SIZE    use SIZE for main memory buffer
  -t, --field-separator=SEP  use SEP instead of non-blank to blank transition
  -T, --temporary-directory=DIR  use DIR for temporaries, not $TMPDIR or /tmp;
                              multiple options specify multiple directories
  -u, --unique              with -c, check for strict ordering;
                              without -c, output only the first of an equal run
  -z, --zero-terminated     end lines with 0 byte, not newline
      --help     display this help and exit
      --version  output version information and exit

Daca aveti vreo nelamurire legata de aceasta comanda va rog postati-o aici. Totodata, daca doriti sa va traduc un argument pe care nu-l intelegeti, ei bine.. cereti-mi-o fara nici o retinere.

0,0 points / 0 votes
ReSpEcT
User avatar
Zatarra
Bit
 
Joined: 01 Jan 2010
Location: /etc/sudoers
Points: 3

Return to Linux

Who is online

Users browsing this forum: No registered users and 0 guests