Don, how can I do as you say. Currently I have to loop through the records one by one changing the value of r.
kristinu,
Sorry for the delay in responding. Hopefully, alister's comments were enough to explain what I was suggesting. If not, the following should work. My script is a little more complex than your original script because the awk I'm using doesn't allow multiple characters in RS. So, you can simplify it on your system, but the following is more portable to other systems.
If you wanted to run this on a Solaris/SunOS system, you'd need to use /usr/xpg4/bin/awk or nawk instead of awk.
Note that this script produces files p001.ps, p002.ps, etc. If you have less than 100 sections or more than 1000 sections in p.dat, you could change the %03d in the sprintf() format string to specify a different number of digits in the output file names.
I have not tested it, but it looks like that code will send a ">" into the pipe if the first "dataset" is empty. Also, if a "dataset" is empty, should psxy be invoked and immediately read EOF? If so, then the above is incorrect in that respect as well.
The problem statement was insufficiently precise to make those determinations, so neither case may be of concern. Just an observation.
I have not tested it, but it looks like that code will send a ">" into the pipe if the first "dataset" is empty. Also, if a "dataset" is empty, should psxy be invoked and immediately read EOF? If so, then the above is incorrect in that respect as well.
The problem statement was insufficiently precise to make those determinations, so neither case may be of concern. Just an observation.
Regards,
Alister
Thanks Alister,
I considered both of these issues, but the idea of graphing zero points didn't make any sense to me. So, I didn't worry about those cases. However, I should have stated my assumptions when I posted my proposal.
I have a process that requires me to read data from huge log files and find the most recent entry on a per-user basis. The number of users may fluctuate wildly month to month, so I can't code for it with names or a set number of variables to capture the data, and the files are large so I don't... (7 Replies)
Hi everyone,
I am trying to write a bash script which reads a data file and does some algebraic operations.
here is the structure of data.xml file that I have;
1 <data>
2 .
3 .
4 .
5 </data>
6 <data>
7 .
8 .
9 .
10</data>
etc.
Each data block contains same number of lines (say... (4 Replies)
I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array?
while read line; do
read -A array <<<$line
n=${#array}
for ((i=1;i<$n;i++)); do
print... (1 Reply)
I have a requirement to read the xml file and split the files into two diffrent files in Unix shell script. Could anyone please help me out with this requirement.
Sample file
---------------
0,<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Information... (3 Replies)
Hi,
I have below type of data in a text file in unix.
Emp_Name Emp_Dept
Raj 101
Amruta 100
Shilpa 100
Rohit 123
Amol 198
Rosh 101
Gaurav 198
Number of employees can be even more.
Need a command or a... (2 Replies)
Hi, I am writting some perl scripts for daily backup process. In which I want to pass some data/referance from another txt file. Text file contains only one column and multiple rows. I want to pass this data to variables of another perl script.
e.g.
Refdoc.txt file contains data as:
perl1... (3 Replies)
There is one Text file data.txt.
Data within this file looks like:
a.sql
b.sql
c.sql
d.sql
.....
.....
want to write a shell script which will access these values within a loop, access one value at a time and store into a variable. can anyone plz help me. (2 Replies)
Hi,
I have a sample data file that contains name-value pairs in it.
For example:
name1=value1
name2=value2
name3=value3
...
...
...
My concern is
1. How to get values of name1, name2, name3 using korn shell script?
2. I don't want to access each varible using $name1,$name2, $name3... (2 Replies)
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)