01-16-2007
if you change the list after every 5 rows them try somthing like this.
In basic shell
#!/usr/bin/sh
row=1
list=1
IFS=";"
while read a b c d; do
echo "$a $b $c $d list[$list] row[$row]"
row=`expr $row + 1`
list=`expr $list + 1`
if [ $row -eq 6 ]
then
row=1
fi
if [ $list -eq 6 ]
then
list=1
fi
done<datafile
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I have a problem with my loops. I have a file called users.dat, it has all the users in it. Then I extracted a list of users sending out number of mails with date from Netscape logs. The extracted list (mailuse.dat) has 3 fields: username, number of mails, date. (One user can show up several... (2 Replies)
Discussion started by: nitin
2 Replies
2. Shell Programming and Scripting
Hi All,
I am having trouble through, I am reading the input from tab delimited file containing several records,
e.g.
line1 field1 field2 field3 so on..
line2 field1 field2 field3 so on..
..
..
on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies
3. Shell Programming and Scripting
Hi,
I have 5 files basically;namely file1.txt situated each at folder A to E respectively.
I would like to extract out third column from each of these file1.txt from folder A to folder E. Also, I wanted to extract the first and second column which are common. In other words, e.g
... (6 Replies)
Discussion started by: ahjiefreak
6 Replies
4. Shell Programming and Scripting
Hi all
I have two file that contain different data.I want to get each file data line by line in one loop.i try with cat but cat works ok against one file
File a
23
34
45
File b
abc
xyz
cgh
now i want like this in a loop.Below is just example.i am doing some thing smiler.can any... (3 Replies)
Discussion started by: aliahsan81
3 Replies
5. Shell Programming and Scripting
Hi, I have a file with the following data
-0.00000 0.00000 0.00000 F F F
0.00000 0.00000 0.80000 F F F
0.50000 0.50000 0.60000 F F F
0.50000 0.50000 0.20000 F F F
-0.00000 0.00000 0.40000 F F F
I would like to change the last 3 lines from F F F to T T T. I tried looping each line but don't... (5 Replies)
Discussion started by: princessotes
5 Replies
6. Shell Programming and Scripting
The script is following :
for each_rec in <file_name>
do
count=`cut -c -2 ${each_rec} | grep "45"`
echo ${count}
if ] then
amount=`cut -c 24-35 ${each_rec}`
echo ${amount}
else
echo "failed"
fi
done
And the file looks like below :
... (4 Replies)
Discussion started by: mady135
4 Replies
7. Shell Programming and Scripting
so this is what i want to do. i have data that looks like this:
DATA:
Array: A
Interface Type: SAS
Unused Space: 0 MB
Status: Failed
Logical Drive: 2
Size: 279.4 GB
Fault Tolerance: RAID 1
Heads: 255
Sectors Per Track: 32... (2 Replies)
Discussion started by: SkySmart
2 Replies
8. Shell Programming and Scripting
I need to graph data that's in a file. however, i only know of a way to graph data as it comes (meaning, as it is spat out by whatever process or job). i dont know how to graph data in a file.
im using rrdtool to graph data. and i was wondering if anyone know of a way to pass a file (the... (3 Replies)
Discussion started by: SkySmart
3 Replies
9. Shell Programming and Scripting
Good midday and hello to everyone! =)
If I describe some things wrong please be aware, that english is not my native language!! :D
I'm a bit stuck with a script I need to finish. Due to data protection I need to hide some paths but that should be no problem.
My script connects to a db2... (1 Reply)
Discussion started by: dsondermann
1 Replies
10. Shell Programming and Scripting
Change IP to multiple servers based on a database file. Source ip file is not incremental.
# Source host
#cat hosts
server1
server2
server3
server4
server5
server6
# SOURCE file
#cat ip
Host IP Netmask GW
server1 192.0.0.1 ... (2 Replies)
Discussion started by: invinzin21
2 Replies