regex - How to print text excerpt of columns with AWK? -


i'm facing challenge print formated values of csv file in format showed bellow:

id=z123456;pseudocode=zxcdsa-12345 id=2345678;pseudocode=123456-rewqa id=abcsd34;pseudocode=23456 

i'm trying desirable output:

z123456;zxcdsa-12345 2345678;123456-rewqa abcsd34;23456 

with command bellow can print both columns don't know how extract text piece both columns $1 , $2

awk -f";" '{ print $1 ";" $2}' sample.csv 

with $1 needed extract portion between id= , semi-colon field delimiter. second column $2 match pattern print after string "pseudocode=" until end of line.

after end write result in file like:

awk -f";" '{ print $1 ";" $2}' sample.csv > result.csv 

how can accomplish result awk?

thanks help.

you can use ; , = field separators:

awk -f'[;=]' '{ print $2 ";" $4 }' file 

where [;=] character class ; , =

or sed:

sed 's/[^=;]*=//g' file 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -