unix shell script
How do I cut fields from multiple files and redirect hem to a new file?
This is the script... the only problem I am having is getting the cut command to parse all of the files.... cd /no5odd/cidata for i in imoddhs*.out do SM=`echo $i | sed -e "s/^imoddhs//" -e "s/.out$//"` echo "$SM\\nRT_MISC\\nBR\\n/unixa/users/cyrtmisc$SM\\n" |odbe> /dev/null wait done cut -f1,6,10 cyrtmisc$SM > cynewrtmisc <<--this line does not work wait lpr -s < /unixa/users/cynewrtmisc rop0 rm cynewrtmisc ; rm cyrtmisc* exit 0 |
I don't think anyone can help without knowing:
1. The format of your input files 2. the output you expect 3. the output you are actually getting |
input files
Here is an example of one of the multiple input files - but I am not having a problem with the format - the "cut" utility is just giving me a cannot open error...
# pg cyrtmisc5 4ce TR303INT 672 0 0 5007 CKTNULL ENV_AUTO 4 XENAU FDRS CAC NAV 14 DBNO DBNO OUTPUT: # cyrt_misc.sh Collecting data... Compiling data... please be patient... cut: cannot open cyrtmisc5 <<---------------------------- Report completed... printing to switch ROP cyrt_misc.sh: /unixa/users/cynewrtmisc: cannot open rm: cyrtmisc* non-existent |
manual entry
If I enter the command at the prompt - does exactly what I want it to do...
#cut -f1,6,10 cyrtmisc$SM > cynewrtmisc creates the "cynewrtmisc" file exactly the way I want it to... just won't work out of the script... |
Quote:
In any event your file cyrtmisc5 doesn't exist... |
I got it.... thanks anyway...
|
Quote:
Code:
SM=${i#imoddhs} |
Since you asked for help, and got it (whether or not it did you any good doesn't really matter) maybe you could be solidary and share your sollution as well
(the only way to learn is by seeing as many sollutions as possible and I'm curious;)) |
Quote:
|
You're right of course, so let's have it...
|
All times are GMT -5. The time now is 12:19 PM. |