?
Solved

remove /n using sed

Posted on 2011-09-23
3
Medium Priority
?
367 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
3 Comments
 
LVL 16

Assisted Solution

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

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 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