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


Filtering text

Posted on 1999-07-14
Medium Priority
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)
Question by:shlomi
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

Expert Comment

ID: 2011490
Use the chomp method in Perl.

This perl script reads in a file and spits it back out without any "\n"'s.


open(INFD,$infile) or die "$!\n";
while(<INFD>) {

LVL 84

Expert Comment

ID: 2011491
grep -v '^$'

Author Comment

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

Author Comment

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

Accepted Solution

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

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