Hi,
my input file is like this I want to remove the blank line.
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100080039.lab"
r
a
N
e
l
a
k
sh
a
m
.
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100070453.lab"
a
v
a
s
aa
n
i
k
k
u
n_
n_
u
.
My output should be like this
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100080039.lab"
r
a
N
e
l
a
k
sh
a
m
.
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100070453.lab"
a
v
a
s
aa
n
i
k
k
u
n_
n_
u
.
If by "blank" you actually mean "empty", the simplest approach is to use tr
to squeeze multiple consecutive newlines into one.
You can handle blank and/or empty lines with ed
(hint: g and d commands), sed
, grep
, or awk
.
You've been a member for nearly a year and this is a very simple problem. What have you tried? Did you even search the forum?
Regards,
Alister
Hello,
Could you please use the following.
awk '!/^$/' filename
Output will be as follows.
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100080039.lab"
r
a
N
e
l
a
k
sh
a
m
.
"/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100070453.lab"
a
v
a
s
aa
n
i
k
k
u
n_
n_
u
.
Thanks,
R. Singh
1 Like
The best way to remove blank lines including lines with just spaces and/or TABs is:
awk NF file
2 Likes