Getting the duplicated line of a stream

This command is to get the duplicated row/line out of a text stream:


more text.txt | uniq -d


Published with Blogger-droid v2.0.4

Print specific column from a stream with pipe separator

This is the command to print a defined column out of a text stream which has pipe "|" separator.


example, given a text stream example.txt of:

test1|column 1 | row 1

test2|column 1 | row 2

test 3|column 1 | row 3


Need to extract to:

column1,row1

column1,row2

column1,row3


The command is:

more example.txt | awk 'BEGIN {FS="|"} {print $1 "," $2}'


Published with Blogger-droid v2.0.4

Nice Blog!!