hello
i want to access line by line from a file and print that line every time can i have a shell script for doing this
thanks
hello
i want to access line by line from a file and print that line every time can i have a shell script for doing this
thanks
I think you are after a loop for reading and processing records in your file, else just running:-
cat filename
would be all that you need.
Can you explain the process you are trying to achieve a bit better. Just something like "I want to print every line in a file" will not get much help. What do you want to do with each line? Is it every line? Do you want to select some lines by content, line number, join lines up or anything?
Thanks, in anticipation,
Robin
Liverpool/Blackburn
UK
thanks for your response
actually i have a list of path names in a text file line by line, each and every time i need to access a path name from the file and i need to use that path in the program to access a formatted file present in that path name this process should be run like loop.
my text file contains path names like this
"ram/abc/1
ram/abc/2
ram/abc/3
ram/abc/4
"
in a loop i need to access first path name and i want to access file present in that after this i need to access second path name that is also used for the same purpose
thank you
Please use the code tags to wrap around your output.
Consider the loop:-
#!/bin/ksh
while read dir
do
echo "Working on directory $dir"
some processing here
done < input_file
Does that structure help? For each line in the input file, it will print out the message and anything else you care to insert.
I hope that this helps.
Robin
Liverpool/Blackburn
UK
thank you very much
it works for me