"How to read lines from a file"
Hi,
I want to read lines from a file line-by-line and to display those lines on the terminal. Can any one please provide a shell script for this.:study: |
cat filename | more -1
The "|" is the pipe sysmbol (shift \ on my keyboard). |
Hi,
I'm not sure what you're trying to do, but I'd use sed, e.g. Quote:
Quote:
Cheers |
Quote:
What are you trying to achieve? To read each line into a variable you could do: Code:
#!/bin/bash To do the same thing in Perl (which doesn't strip out leading spaces or tab characters): Code:
#!/usr/bin/perl |
Thanks
Thanks all,
i got the answer.........:) |
The simplest and most readable way is (IMO):
Code:
while read line |
All times are GMT -5. The time now is 10:00 PM. |