0

I have a file.txt which contains for exmaple

/tmp/blabla/
/tmp
/blabla/tmp/muzi
/muzi/puzi/bla/bla/tmp

I need to write a function that accept input from user and go ahead removing the EXACT match in the file


function Remove_Project_Dir () {
  [[ $(grep -w $1 $version_db_file | wc -l) != 0 ]] && sed -i '/"$1"/d' $version_db_file || echo "Directory supplied doesnt exist in version db"


}

#Should only remove /tmp if there's such thing
Remove_Project_Dir /tmp

I'm having trouble with sedding string that has "/" in it, also cannot find how to delete only the exact match. any help would be greatly appreciated

Toto
  • 86,179
  • 61
  • 85
  • 118
Shahar
  • 439
  • 1
  • 12

0 Answers0