reading a line into a variable in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers reading a line into a variable in unix
# 1  
Old 02-07-2007
reading a line into a variable in unix

hi...

i need to open a file and read it line by line, and capture that it in to some variable and manipulate...
i need to get a line in to a variable

please help Smilie
# 2  
Old 02-07-2007
In the future use the 'Search' function of these forums.
For now - looky here
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Help for reading line

Hi there, I am trying to read the content such that if there is 'adsmsext.dll', it will read everything from line one until it reads line 6 with 'C:' then it will terminate at line 5. 1. C:\WINDOWS\system32\adsmsext.dll NT AUTHORITY\Authenticated Users:R 2. ... (5 Replies)
Discussion started by: alvinoo
5 Replies

2. Shell Programming and Scripting

Reading text file, comparing a value in a line, and placing only part of the line in a variable?

I need some help. I would like to read in a text file. Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01. Is this possible? any help is appreciated. (2 Replies)
Discussion started by: xChristopher
2 Replies

3. Shell Programming and Scripting

Reading of variable in a single line command

Hi All, Below is a sample command that I can run without any problem in the command line. Command Line dtToday=`date +%Y%m%d`; ls -ltr ./filename_${dtToday}.txt -rw-r--r-- 1 monuser oinstall 0 Jan 18 11:02 ./filename_20130118.txt But once I put that command line in file (list.txt) and... (3 Replies)
Discussion started by: padi
3 Replies

4. Shell Programming and Scripting

EXPECT: Assign variable by reading a line of text from a file

Hi All, I have been using a program on windows called AutoKey. My environment at work is Linux and I have been experimenting with expect. Very powerful. I can move my AutoKey scripts to Linux using Expect once I am educated on how to read from a file using Expect. My application would be... (1 Reply)
Discussion started by: quemalr
1 Replies

5. Shell Programming and Scripting

Help needed in reading line value into variable

I have a file which has data in 8 lines: 10 34 6 1 4 46 67 31 I am trying to read each value into each different variable so that I use these variables in preparing my report. Another option is to dynamically print each line values in the report like below: users with privA:... (2 Replies)
Discussion started by: sarat949
2 Replies

6. Shell Programming and Scripting

Reading line1 with line2 and line 2 with line 3 in unix

Hi, I have a requirement where i have to read a file line by line and see if the string(fixed postion 10 to 15 in the file) in line 2 is greater than string in line 1. I have used following code while read LINE1 do current_inv_no=$(echo "$LINE1" | cut -c 10-15) read... (2 Replies)
Discussion started by: chethanbg2010
2 Replies

7. UNIX for Dummies Questions & Answers

Parsing file, reading each line to variable, evaluating date/time stamp of each line

So, the beginning of my script will cat & grep a file with the output directed to a new file. The data I have in this file needs to be parsed, read and evaluated. Basically, I need to identify the latest date/time stamp and then calculate whether or not it is within 15 minutes of the current... (1 Reply)
Discussion started by: hynesward
1 Replies

8. Shell Programming and Scripting

Reading line by line from unix script

Hi I am a complete newbie in unix. Learning the ropes. I have a task where I have to write a shell script to read a file line by line. I have tried some code from the net like. The file data looks like this. FIN427;2010003;2010003 FIN475;2010001;2010003 FIN476;2010001;2010003... (4 Replies)
Discussion started by: chamajid
4 Replies

9. Shell Programming and Scripting

reading the whole line from a file into a variable

Hi, I am doing : while read line do printf "%s\n" ${line} done <datafile.txt but I am not getting each single line from the data file assigned to the variable line (but only tokens/fields at a time). I also tried while IFS= read -r lineI want the whole line assigned or read into the... (2 Replies)
Discussion started by: shri_nath
2 Replies

10. Shell Programming and Scripting

reading line by line a variable

Hello, I have a variable Diskfree and I would like to read it line by line to extract information, I don't know how to get the line Diskfree=`df -h | grep dev` I want to make a loop to get each value of this line, but I don't know how to get the line. I've seen sample with standard... (4 Replies)
Discussion started by: pppswing
4 Replies
Login or Register to Ask a Question