Computing.Net > Forums > Unix > cancel the enter key in a text

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

cancel the enter key in a text

Reply to Message Icon

Name: edmondo
Date: March 13, 2006 at 03:12:04 Pacific
OS: xp 2003
CPU/Ram: centrino
Product: sony
Comment:

I am looking for the sed command to cancel all the enter keys in a corpus. I have eliminated the tab key with sed -e 's/\t//g' but I don't know how to do it with the enter key.
Thank you


Edmondo



Sponsored Link
Ads by Google

Response Number 1
Name: FishMonger
Date: March 13, 2006 at 09:50:31 Pacific
Reply:

Do you really want to remove all line endings which will put everything on 1 line?

s/\n//g


0

Response Number 2
Name: edmondo
Date: March 16, 2006 at 05:24:37 Pacific
Reply:

Thank you Fishmonger.
Yes I need to lemmatize a corpus and I need to remove all line endings. The enter key seems to disturb the lemmatizing process. I've tried the sed -e 's/\n//g' but I still see the file unchanged. The command does not work...


Edmondo


0

Response Number 3
Name: nails
Date: March 21, 2006 at 20:59:02 Pacific
Reply:

This solution doesn't use sed, but seems to work. echo'ing a variable to xargs emulates what you want:

#!/bin/ksh

myvar=$(cat <<MSG
line 1
line 2
line 3
MSG)

# myvar with LFs
echo "$myvar"
echo
echo

# myvar without LFs
echo "$myvar"|xargs


0

Response Number 4
Name: FishMonger
Date: March 23, 2006 at 08:06:24 Pacific
Reply:

sed -e 's/\r//g'


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


substring extraction change variables in for l...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: cancel the enter key in a text

Enter key in unix www.computing.net/answers/unix/enter-key-in-unix/6994.html

Search for words in a text file www.computing.net/answers/unix/search-for-words-in-a-text-file/7915.html

insert a delimeter in a text www.computing.net/answers/unix/insert-a-delimeter-in-a-text/7677.html