Hello everyone,
I'd like to remove a line, and replace to other line by shell script.
Would you please notify how can i do it?
Thanks in advance,
Dong-Gook Kim.
I'd like to remove a line, and replace to other line by shell script.
Would you please notify how can i do it?
Thanks in advance,
Dong-Gook Kim.
> I'd like to remove a line, and replace to other line by shell script.
> Would you please notify how can i do it?
> Thanks in advance,
> Dong-Gook Kim.
1. # How to read a textfile line by line using csh shell script ?
Dear *nix fellows
A "simple" question concerning file read
#!/bin/csh -f
#
# How to read a textfile line by line using csh shell script ?
# Os for example : HP-UX 10.20 or 11
#
set READTEST = readtest.txt
printf "Creating $READTEST file\n"
echo "1) ooo-557.06.7055 rrrrrr iiiiiii prj oooooo 1
tgps#9012345" > $READTEST
echo "2) bbbbbb-sa_mcu#01.01.095_f_04.31 rrrr mmmm prj vvvv 1
tgo#45678" >> $READTEST
echo "3) aaa-ccccc#23402.34-50454 rrrr vvvvvv prj IIII 1
tg#12345" >> $READTEST
echo "4) sssss-23401.02.010 rrrrrr hhhhhh prj ssssss 1
tg#456465" >> $READTEST
#
printf "Reading $READTEST file\n"
# while (`read -r xx yy < $READTESTFILE`)
set S=`line < $READTEST`
printf "$S\n"
printf "$S[2] $S[3] $S[6] $S[8]\n\n"
#
# do
# HP-UX man page example (shell sh)
# while read -r xx yy
# do
# printf "%s %s \n" "$yy" "$xx"
# done < input_file
#
while (`read -r xx yy < $READTEST` != 0)
# do
# printf "%s %s \n" "$yy" "$xx"
# printf "$S\n"
printf "Next line generates an error undefined \n"
printf "$yy $xx\n"
# done < $READTESTFILE
end
exit
Script output
----------------
Creating readtest.txt file
Reading readtest.txt file
1) ooo-557.06.7055 rrrrrr iiiiiii prj oooooo 1 tgps#9012345
ooo-557.06.7055 rrrrrr oooooo tgps#9012345
Next line generates an error undefined
yy: Undefined variable.
3. unix shell script to access a file line by line
4. how to make an inode density when installing RH
5. How to read text line-by-line in shell script?
7. Question about shell script, can you enter a script at a specific line?
9. SED: Converting 5 line script into 1 line script
10. handling SIGINT in shell scripts when executing another shell script.
11. Q: How can I have a shell script call another shell script...
12. Shell script invoking other shell scripts
13. Convert Bash shell script to Korn shell script