Hi ,
I need to right a script in which I need to search for a string, which is at 11th column fields saperated by "|" and delete all the lines from the file which contains that string .
Please help
Hi ,
I need to right a script in which I need to search for a string, which is at 11th column fields saperated by "|" and delete all the lines from the file which contains that string .
Please help
Dear viv1,
try this
awk -F'|' 'BEGIN{
while(getline < "filename1")
{
if ( $11 != <SEARCH STRING>)
{
print $0
}
}
}' >> filename2
filename1 will be ur input file and filename2 will be ur output file in which u'll redirect the output. "SEARCH STRING" will be the string u want to search for.
Regards,
Pankaj
u can do it in one line also
awk -F'|' 'BEGIN{while(getline < "filename1"){if ( $11 != <SEARCH STRING>){print $0}}}' >> filename2
Regards,
Pankaj
# awk -F"|" s="$searchstring" '$11!=s' file