Solved

remove /n using sed

Posted on 2011-09-23
3
361 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

732 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