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
– Cyrus Aug 18 at 19:26/
, it should be:#!/bin/bash
– Alex Stragies Aug 18 at 19:29which bash
in the CLI, what gets printed? – BinaryZebra Aug 20 at 5:15which bash
, I get/bin/bash
. – Juan Davila Aug 26 at 14:06