Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filtering text

Posted on 1999-07-14
5
Medium Priority
?
264 Views
Last Modified: 2010-04-21
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)
0
Comment
Question by:shlomi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:crawlspace
ID: 2011490
Use the chomp method in Perl.

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;
}


0
 
LVL 84

Expert Comment

by:ozo
ID: 2011491
grep -v '^$'
0
 

Author Comment

by:shlomi
ID: 2011492
I don't have perl installed and i don't want to install
0
 

Author Comment

by:shlomi
ID: 2011493
OZO your comment is doing the work how do i reward you with the points ?
0
 
LVL 84

Accepted Solution

by:
ozo earned 200 total points
ID: 2011494
I'd have to lock an Answer, then you can grade it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question