devutils/ATFQ/book ATFQ git

Part III · Shell and commands

28. Finding and transforming

  1. 28.1findfind walks a folder and everything under it, and prints each path that matches your tests.
  2. 28.2grep and regexgrep prints the lines that match a pattern, in files or in what you pipe into it.
  3. 28.3awkawk reads text line by line and splits each line into fields: $1, $2… and $NF, the last one.
  4. 28.4sedsed edits text line by line as it flows through. Its most used command is s/old/new/.
  5. 28.5xargsxargs turns its input into arguments for a command, many at a time.
  6. 28.6tarc creates, x extracts, t lists. f names the archive file and v prints each file name.
  7. 28.7rsyncrsync copies files and only transfers what changed: run it again and it finishes fast.
  8. 28.8jqjq filters JSON: give it a path, get the value back.
  9. 28.9sort, uniq and cutsort sorts lines: -n by number, -h by size with units (2K, 1G), -r in reverse, -k 2 by the second column.