Difference between revisions of "AWK"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with " awk '{print $0}'")
 
Line 1: Line 1:
 
  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>

Revision as of 12:39, 4 October 2017

awk '{print $0}'

To use brackets as a seperator

[1]

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