Bash: Read lines in a file scenario with sed or awk
Posted
by
user105566
on Server Fault
See other posts from Server Fault
or by user105566
Published on 2013-10-28T12:35:51Z
Indexed on
2013/10/29
3:58 UTC
Read the original article
Hit count: 489
I have this scenarios:
File Content:
10.1.1.1
10.1.1.2
10.1.1.3
10.1.1.4
I want sed or awk so that when i cat the file every time new line is returned.
like
First iteration:
cat ip | some magic
10.1.1.1
Second iteration returns
10.1.1.2
Third iteration returns
10.1.1.3
Fourth iteration returns
10.1.1.4
and after n number of iterations, it returns to line 1
Fifth iteration returns:
10.1.1.1
Can we do it using sed or awk.
© Server Fault or respective owner