How to track of reading of multiple files

How to track of reading of multiple files

Post by Haritha Potlapall » Thu, 28 Feb 2002 10:10:18



Hi,

I am beginer of wrinting shell script. Like to know
When reading a file in bourne shell,Using exec on a file1 and
read (in while loop condition), it reads as until end of file1
as reached. But I also want to read another file inside the
loop, can you tell me how to do this multi track of reading files.

Is there any easier way in other shell scripts I can use.

Another quetion how to pipe a command output to a Variable?

Thanks,
Haritha Potlapalli,

Phone: 703-993-2936.

 
 
 

How to track of reading of multiple files

Post by eugene ki » Thu, 28 Feb 2002 11:06:43


i'm a newbie too..

try .. in your shell script

for i in $*
do
        echo $i
done

and execute your script with argument..

try this

Quote:> variable=`your command`

(` is not ')
or
Quote:> variable=$(your command)


 
 
 

How to track of reading of multiple files

Post by Michael P. Reill » Thu, 28 Feb 2002 13:19:51



>  Hi,

>  I am beginer of wrinting shell script. Like to know
>  When reading a file in bourne shell,Using exec on a file1 and
>  read (in while loop condition), it reads as until end of file1
>  as reached. But I also want to read another file inside the
>  loop, can you tell me how to do this multi track of reading files.

>  Is there any easier way in other shell scripts I can use.

>  Another quetion how to pipe a command output to a Variable?

The old fashioned method is to use file descriptors and exec.

###
exec 3<file1 4<file2  # open file1 on fd3 and file2 on fd4
while :
do
  # if read fails, it reached an EOF
  read line1 <&3 || break   # read a line from fd3 (file1)
  read line2 <&4 || break   # read a line from fd4 (file2)
  ...
done
exec 3<&- 4<&-  # close the open files
###

Capturing output to a variable is with backticks:
var=`cat filename`
echo "$var"

  -Arcege

--
+----------------------------------+-----------------------------------+

 
 
 

1. ??:How To Read Multiple Data Tracks From A CD??

Hi All;

I'm trying to find out how to read multiple data tracks from a CD!  If
I use "dd" I only get the first track.  Do I need a separate program
to do this or can I give specific parameters to "dd" to do it.  I
haven't been able to figure it out from the man page.

In particular, I'm trying to read the individual tracks listed when
you do a "cdrecord -toc" on a multisession CD.

Just as a side note I can read audio tracks off with cdda2wav, then
write them back to create a new audio CD.  How do I do it with data?

Thanks in advance.

 ------------------------------------------------
   Doug Mitton - Brockville, Ontario, Canada
                 'City of the Thousand Islands'

          http://www.cybertap.com/dmitton
         Other: mitton.dyndns.org
   SPAM Reduction: Remove "x." from my domain.
 ------------------------------------------------

2. Linux questions

3. read/write multiple data tracks on cdRW

4. mod_ssl, HTTP 1.1, and IE

5. How to read the harddisk track by track?

6. Increasing Message Queue's

7. How can I read the harddisk track by track?

8. LILO freaking a bit?

9. Reading data from multiple files to a single file

10. Reading an CD Audio track to a file (CDDA)

11. Reading flat ascii file from 9-track

12. Solution: multiple Apache log files, multiple args to env=, multiple conditions to CustomLog directive