Guest_imported
New member
- Jan 1, 1970
- 0
I have a fixed width file and I want to be able to give a user (in a script) an option to view the first 8 characters and 24-30 and change the first 8 to what they want.
I have started a script using cut and sed, but haven't got very far.
Please help. Here is the first part of the script that get's me the info. (The second field is the unique identifier. )
cut -c 1-8,24-30 datafile >outfile
echo "\n\nHere are the variables that can be changed...\n"
cat outfile
echo "\nPlease Enter exactly the strings that you want to change...\c"
read ans1;export ans1
sed 's/ $ans1/ALEXGGG/' outfile >newfile
#EOF:
(the $ans1 also doesn't work with sed)
I have started a script using cut and sed, but haven't got very far.
Please help. Here is the first part of the script that get's me the info. (The second field is the unique identifier. )
cut -c 1-8,24-30 datafile >outfile
echo "\n\nHere are the variables that can be changed...\n"
cat outfile
echo "\nPlease Enter exactly the strings that you want to change...\c"
read ans1;export ans1
sed 's/ $ans1/ALEXGGG/' outfile >newfile
#EOF:
(the $ans1 also doesn't work with sed)