I would like to modify a file to replace keys, suppose these keys are in the file as:
42NM
52NM
23NO
XNNM
I would like to replace anything with NM, with the word "Okay".
1 #!bin/bash/
2
3 if [ -f KeyFile]
4 then
5 sed 's/[0-9][0-9]NM/Okay/g' KeyFile
6 else
7 echo "File does not exist or cannot be found."
8 fi
9
10 exit 0
I ran the command:
chmod a+x FindKeys
and then, when I attempt to run the script, I get:
-bash-3.00$ ./FindKeys
-bash: ./FindKeys: bin/bash/: bad interpreter: No such file or directory
I seem to have two problems, one the script file is not running correctly, and two the sed command is not working.
sed -i 's/NM/Okay/' KeyFile/, it should be:#!/bin/bashwhich bashin the CLI, what gets printed?which bash, I get/bin/bash.