Reading lines instead of tokens trips me up too...
but the following code will process each line one by one:
for n in {1..file_length}; do head -$n /etc/hosts | tail -1 | your_command ; done
where "file_length" is the number of lines in your /etc/hosts file.
and "your_command" is what you want to do to the line.
leave out the pipe to "your_command" and it essentially echos the file one line at a time.
If there's a better way to do this without resorting to a real computer language, I'd like to know too.
Hope that helps.
|