Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

remove /n using sed

Posted on 2011-09-23
3
Medium Priority
?
365 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 1000 total points
ID: 36586787
sed -e 's?/n??' <filein >fileout
0
 
LVL 80

Accepted Solution

by:
arnold earned 1000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

636 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