Search and remove in a text file

Need help whit a script where I have to input a name and then remove a line where that name is in a file

file ex:
001op;Name;Location;date
002op;Name;Location;date

and so on....

can anybody help me???

thanks

Based on your input (name in field 2 of a semi-colon-delimited file)

read NAME
awk -F";" '
  $2 != NAME
' NAME="$NAME" input_file

you can use sed for this

sed -i '/pattern/d' filename

or

cat filename | sed '/pattern/d'

note: pattern is the name you are looking for..

You can use sed for this, but:

  1. -i may not be available
  2. It will delete any line with "pattern", which is not what was asked
  3. (and) cat is useless here

Well I really needed it to remove just the line where the name is