Trying to read in a file line at a time, and output each entry to a text file in different order.
From: Tonij (tonij67_at_hotmail.com)
Date: 07/02/04
- Next message: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Previous message: rakesh sharma: "Re: sed -e 's/\nFOO\n/\\chapter{FOO}/g'"
- Next in thread: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Ed Morton: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Chris F.A. Johnson: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: John W. Krahn: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: RMH: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 2 Jul 2004 06:17:15 -0700
I can't figure out whats wrong with my script.
I am trying to read in a file that has multiple lines in this format:
(cat dflist)
/dev/dsk/c1t0d0s0 /
/dev/dsk/c1t0d0s4 /usr
/dev/dsk/c1t0d0s3 /var
What I am after is output similar to this:
Service Description: /
CheckCommand: /dev/dsk/c1t0d0s0
Service Description: /usr
CheckCommand:/dev/dsk/c1t0d0s4
Service Description: /var
CheckCommand:/dev/dsk/c1t0d0s3
etc...
Here is what I have so far:
#!usr/bin/ksh
for fs in `cat dflist`
do
Service=`echo $fs | awk '{print $1}'`
CheckCommand=`echo $fs | awk '{print $2}'`
echo "Service Description:" $Service
echo "CheckCommand:" $CheckCommand
done
This is what I am getting when I run it:
Service Description: /dev/dsk/c1t0d0s0
CheckCommand:
Service Description: /
CheckCommand:
Service Description: /dev/dsk/c1t0d0s4
CheckCommand:
Service Description: /usr
CheckCommand:
Service Description: /dev/dsk/c1t0d0s3
CheckCommand:
Service Description: /var
CheckCommand:
What am I doing wrong? This seems like it should be simple but for
the life of me I cannot get the fields in the right place.
Any info appreciated,
- Next message: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Previous message: rakesh sharma: "Re: sed -e 's/\nFOO\n/\\chapter{FOO}/g'"
- Next in thread: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Stephane CHAZELAS: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Ed Morton: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: Chris F.A. Johnson: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: John W. Krahn: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Reply: RMH: "Re: Trying to read in a file line at a time, and output each entry to a text file in different order."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|