Difference between revisions of "AWK"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with " awk '{print $0}'")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
<ref>http://www.thegeekstuff.com/2010/01/8-powerful-awk-built-in-variables-fs-ofs-rs-ors-nr-nf-filename-fnr/?ref=binfind.com/web</ref>
 +
==General Notes==
 
  awk '{print $0}'
 
  awk '{print $0}'
 +
==To use brackets as a seperator==
 +
<ref>http://bytefreaks.net/gnulinux/bash/linux-bash-get-text-between-brackets</ref><br>
 +
<pre>
 +
echo "D:AI(A;OICI;GRGX;;;S-1-5-21-XXXXX0)(A;OICIID;0x1200a9;;;AU)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;S-1-5-21-XXXXX1)" | awk 'NR {print $1}' RS='(' FS=')'
 +
D:AI
 +
A;OICI;GRGX;;;S-1-5-21-XXXXX0
 +
A;OICIID;0x1200a9;;;AU
 +
A;OICIID;FA;;;SY
 +
A;OICIID;FA;;;BA
 +
A;OICIID;FA;;;S-1-5-21-XXXXX1
 +
</pre>

Latest revision as of 13:37, 4 October 2017

[1]

General Notes

awk '{print $0}'

To use brackets as a seperator

[2]

echo "D:AI(A;OICI;GRGX;;;S-1-5-21-XXXXX0)(A;OICIID;0x1200a9;;;AU)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;S-1-5-21-XXXXX1)" | awk 'NR {print $1}' RS='(' FS=')'
D:AI
A;OICI;GRGX;;;S-1-5-21-XXXXX0
A;OICIID;0x1200a9;;;AU
A;OICIID;FA;;;SY
A;OICIID;FA;;;BA
A;OICIID;FA;;;S-1-5-21-XXXXX1