Linux/Parsing

From Wiki
< Linux
Revision as of 15:49, 24 November 2020 by Marcluer (talk | contribs) (→‎chars)

lines

  • grep
grep -v ^$        # remove empty lines
  • tail
tail 
tail -f                # follow
tail -n 10             # last 10 lines
tail +3                # skip first 3 lines 
  • wc
wc -l                  # count lines 

chars

  • cut
    uname -a 
    -> Linux nutzer-laptop 3.2.0-030200-generic #201201042035 SMP Thu Jan 5 01:36:31 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    
    uname -a | cut -d" " -f1,3,12 
    -> Linux 3.2.0-030200-generic x86_64
    
  • tr

sed & awk

  • sed + control characters
sed 's/\x00/controlcharwashere/g'
sed -n '/Iowa/,/Montana/p'


other

  • slowing output
cat incoming.log | pv -qL 1000 | tee temp
  • show as hex
od -t x1 -An



Links