Sponsored Content
Top Forums Shell Programming and Scripting want to read variable for the file Post 302443802 by zaxxon on Tuesday 10th of August 2010 05:29:16 AM
Old 08-10-2010
Maybe take a while loop instead:
Code:
while read LINE; do
     echo $LINE
done < infile

For completeness a for loop:
Code:
for a in "`cat infile`"; do
     echo "$a"
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read data from a file into a variable

I am a FORTRAN guy and not a UNIX expert by any means so sorry if this sounds dumb, but all I want to do is have a UNIX script which reads data from a file (say 1000 lines worth, each row is a file name) and store it in an array to perform an operation on later. As maddeningly simple as this... (2 Replies)
Discussion started by: yorkdg
2 Replies

2. UNIX for Dummies Questions & Answers

How can I read variable values from file?

Hi, I want to pratmeterze my scripts like, my confRsync file contains varibale values for 1. host 2. Destination and 3. source like this, I want to read this values from this and assing to my makeRsyn.sh file's varibales. how to do this? (1 Reply)
Discussion started by: redlotus72
1 Replies

3. Shell Programming and Scripting

how to read a value from a file and pass it to a variable

Hi, Some one please help me with this script. I have a file "sequence.txt" and contents of it look like below. 1 5 3 7 4 7 5 74 from my script i should be able to read every single and save the first columnbs to variable x1, x2, x3 and second column as y1, y2, y3 and so on. Then i can... (3 Replies)
Discussion started by: pragash_ms
3 Replies

4. Shell Programming and Scripting

how to read the variable from config file

how to read the variable from config file eg: a.cfg below config file config file which contain a=`hostname` b=250 a.sh is shell script echo "$a and $b" if i run "a.sh 1.cfg" it works but when i declare N number of variable it wont works.. can u please suggest for that ? (1 Reply)
Discussion started by: mail2sant
1 Replies

5. UNIX for Dummies Questions & Answers

Read a file and store each value in a variable

Hi, How to read a file and put the values in a script. E.g. file1.txt 02/12/2009;t1;t2 The script should read this file and put these values in 3 different variables x1,x2,x3 which can be used further. Thanks Ashu (3 Replies)
Discussion started by: er_ashu
3 Replies

6. Shell Programming and Scripting

read string from file into variable

Hello, I need to read from a file consisting of only one integer and enter that number into variable.can anyone help? the script is written in cshell. thanks. (4 Replies)
Discussion started by: offerbukra
4 Replies

7. UNIX for Dummies Questions & Answers

How to read a file into a variable?

Hello, I have a ini-file containing comma-separated e-mail addresses, an bash-script sending a mail. Mail-addresses and the mail-script are separated, so I need not to change the important mail script. But how can I read out the file into a variable? It is possible to handover the mail... (7 Replies)
Discussion started by: ABE2202
7 Replies

8. Homework & Coursework Questions

How to read contents of a file into variable :(

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have to read the contents of each field of a file creating user accounts. The file will be of format : ... (6 Replies)
Discussion started by: dude_me5
6 Replies

9. Shell Programming and Scripting

cut the variable from the line and use it to find the file and read the content of that file

Hi, I am working on one script..I am having files in the below format file 1 (each line is separated with : delimeter) SPLASH:SPLASH:SVN CIB/MCH:MCH:SVN Now I want from file 1 that most left part of the first line will store in... (6 Replies)
Discussion started by: rohit22hamirpur
6 Replies

10. Shell Programming and Scripting

Read variable name from file and use this?

I would like to read a variable name from file and I would like to use this... e.g. VARIABLE1=XXXXXX File.txt $VARIABLE1 Shell for STRING in `cat File.txt` echo $STRING done I would like the print XXXXXX. It's possible????:confused: Thanks :) (7 Replies)
Discussion started by: pinguc
7 Replies
vtopgm(1Vi)															       vtopgm(1Vi)

NAME
vtopgm - convert image from Vista data file to portable graymap SYNOPSIS
vtopgm [-option ...] [infile] [outfile] DESCRIPTION
vtopgm converts one band of an image to a portable graymap (PGM) file. A wide range of filters are available to convert PGM files to other formats. This program only produces portable graymaps whose pixel values are in the range 0 to 255. Any type of Vista image is accepted, but the image is first converted to have ubyte pixels if necessary. This conversion is performed by VConvertImageRange(3Vi). COMMAND LINE OPTIONS
vtopgm accepts the following options: -help Prints a message describing options. -in infile Specifies a Vista data file containing the image to be converted. If the file contains more than one image, only the first is used. -out outfile Specifies the file to contain the portable graymap. -band band Specifies the image band to be converted. Default: 0. Input and output files can be specified on the command line or allowed to default to the standard input and output streams. SEE ALSO
pgm(5), VImage(3Vi), Vista(7Vi) AUTHOR
David Lowe <lowe@cs.ubc.ca> Vista Version 1.12 24 April 1993 vtopgm(1Vi)
All times are GMT -4. The time now is 09:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy