shlomi
asked on
Filtering text
I have a file that looks like:
text text
text text
every second line is a \n char, How do i filter the \n chars (can be second line or just \n)
text text
text text
every second line is a \n char, How do i filter the \n chars (can be second line or just \n)
grep -v '^$'
ASKER
I don't have perl installed and i don't want to install
ASKER
OZO your comment is doing the work how do i reward you with the points ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This perl script reads in a file and spits it back out without any "\n"'s.
#!/usr/bin/perl
open(INFD,$infile) or die "$!\n";
while(<INFD>) {
chomp;
chomp;
print;
}