leviathan:/lcl/apps/Tivoli/netcool/omnibus/bin>more pmonfile.dat
entp_stdby
ot1p_stdby
lawp_stdby
I am wonder how to remove the _stdby from all the values in this dat file using #!/bin/ksh
Thanks!
leviathan:/lcl/apps/Tivoli/netcool/omnibus/bin>more pmonfile.dat
entp_stdby
ot1p_stdby
lawp_stdby
I am wonder how to remove the _stdby from all the values in this dat file using #!/bin/ksh
Thanks!
Here is one way, using sed:
#!/bin/ksh
pfile="pmonfile.dat"
tmpfile="pmonfile.tmp"
sed -e '1,$s/_stdby$//g' pmonfile.dat > $tmpfile
mv -f $tmpfile $pfile
how's that?
One ksh script coming up:
#!/bin/ksh
while read line; do
echo ${line%_stdby}
done <pmonfile.dat >pmonfile.dat.tmp && mv -f pmonfile.dat.tmp pmonfile.dat
sed 's/_stdby$//' pmonfile.dat
For any shell:
cut -d_ -f1 pmonfile.dat