String manipulation

From wiki.techunit.org
Jump to: navigation, search

Sed : Delete double quote from file

 sed 's/\"//g' file.txt

Sed : Replace string in file

sed -i 's/oldstring/newstring/g' file.txt

Awk : printing first word in every line of a txt file

 awk '{print $1}' file.txt

Remove commented lines

grep  -v ^# file.txt | grep -v ^$

Elliot
techUnit's cofounder