Solved

remove /n using sed

Posted on 2011-09-23
3
362 Views
Last Modified: 2012-06-22
Hi,

I have a text file like below,

team alpha 400
team bet/na 800
team ga/nmma 900
team omega 1100

I need to remove /n from above text using sed. I want the new lines to be preserved though.. (after the numbers). Can someone help..

lego..
0
Comment
Question by:legolasthehansy
[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
3 Comments
 
LVL 16

Assisted Solution

by:medvedd
medvedd earned 250 total points
ID: 36586787
sed -e 's?/n??' <filein >fileout
0
 
LVL 78

Accepted Solution

by:
arnold earned 250 total points
ID: 36586897
If you do not alter the separator you use in sed as the example medvedd provided, you have to escape the '/' in '/n' which is done using the '\'
sed -e 's/\/n//' <filein >fileout

The separator can be almost any character as long as you use single quotes(') to enclose the pattern double quotes (") will have the shell process the contents and replace characters that have meaning $,!,etc.. (hedging since I have not tried all options)
0
 
LVL 11

Author Closing Comment

by:legolasthehansy
ID: 36587343
Thanks,

sed -e 's?\\n??' infile worked
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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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