Problem passing variable in a list
What I want to do is grab all invoice files in the pwd and cut two of the fields. One of the field designates the manufacturer which I will need to create the unique file. The second field I will copy to the file that is uniquely named by its manufacturer, call it a car.
First call the files in the pwd. Code:
for i in `cat *inv` Code:
do Code:
if [$x = 1='GM', 2='Ford', 3='Dodge'] Any help would be much appreciated. |
Firstly, using for is not a good way to read a file. It is better to use while as you will then not get incorrect data based on word splitting.
Code:
#awk |
Thank you grail.
I am very aware of the fact that I need to learn awk, any threads or literature that you can suggest so that I can become better at it? |
Just the main manual site:
http://www.gnu.org/software/gawk/man...ode/index.html It reads easily and you should more often then not be able to find a solution to your problem :) |
The grymoire tutorial is good too, although it's written for non-gnu versions of awk and has some typos. Here are a couple of other useful pages as well.
http://www.grymoire.com/Unix/Awk.html http://www.pement.org/awk/awk1line.txt http://www.catonmat.net/blog/awk-one...ined-part-one/ And read here for why you Don't Read Lines With For. |
Thank you as well 'David the H'.
My education feels like its just begun! The problem is that I was a Sys Admin (Network) in a department that ran UNIXWare 5.1 on a 4ESS and 5E switch. I did that for two years and depended completely on the scripts other people wrote. Of course, I wrote a couple here and there but never enough to be proficient at it. Now I am in a position that requires me to write scripts frequently. Basically I have been negligent in my education and am currently behind the ball, so-to-speak. Any help is great. Forgive me if my frustration or lack of knowledge comes out - I am trying! s |
As lonas you show effort you will be rewarded with a plethora of knowledge and feedback. I know have :)
|
All times are GMT -5. The time now is 12:29 PM. |