I want to get the blank line number of a file.
example:
9000|9000|WW|1|1|SL|472|472|LC|2272|1072|MTY|niceDay
9000|9000|WW|1|1|SL|470|470|MC|1270|1172|MPVT|nice
9000|9000|WW|1|1|SL|472|472|LC|1072|1672|MBD|Sonice
9000|9000|WW|1|1|SL|473|473|LF|1173|1173|MTY|nice666
I want to get the result like this:
2
4
6
Thanks!
if you have Python
#!/usr/bin/env python
for n,line in enumerate(open("file")):
if line.strip()=="": print n+1
output
# ./test.py
2
4
6
with awk
# awk '/^$/{print NR}' file
2
4
6
this will do
awk '/^$/{print NR}' filename
The same thing with sed :
sed -n '/^$/=' filename
Jean-Pierre.
It works.
Thank you so much!
And then some more:
perl -ne '{print $.,"\n" if /^$/}' <file>
tyler_durden