I have a text file that\'s about 300KB in size. I want to remove all lines from this file that begin with the letter \"P\". This is what I\'ve been using:
&g
With awk:
awk '!/^P/' file.txt
! (negation), that negates the following pattern ;
/^P/ means "match all lines starting with a capital P", P".awk's behavior when { … } (action block) is missing, that is to print the record validating the condition.So, to rephrase, it ignores lines starting with a capital P and print everything else.
sed is line oriented and awk column oriented. For your case you should use the first one, see Edouard Lopez's reponse.