Reputation: 259
I have file like this
d
e
e
s
k
a
b
c
d
I just need to convert then as like this
dee
sk
abcd
For this purpose I used awk and xargs
xargs < file|awk '{ gsub (" ", "", $0); print}'
But it is not generating results as expected
Upvotes: 3
Views: 244
Reputation: 185254
Using perl:
perl -0pe 's/\n(?=.)//g' file
dee
sk
abcd
Upvotes: 3
Reputation: 133538
Could you please try following.
awk '
!NF && value{
print value
value=""
next
}
NF{
value=value $0
}
END{
if(value){
print value
}
}' Input_file
Upvotes: 3