Showing posts with label Delimiter. Show all posts
Showing posts with label Delimiter. Show all posts

Sunday, January 31, 2016

AWK: Extracting the Values of Specified Columns Separated by a Delimiter

Extracting the second column values from lines with delimiter '|' separating each columns:

awk -F'|' '{print $2}' ./lines.txt

Sed: Replacing Delimiter Characters to Create Comma-Separated Values

Replacing all vertical lines '|' with comma ',':

cat ./lines.txt | sed s/\|/,/g