LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-27-2011, 03:41 AM   #1
grooper
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
Shell script to remove new line after numeric string


Hi. I need to write a SHELL Script to remove new line after only after a numeric string? or after string doesn't start with number. For example a have a file:
asasas
12345
adab-123
123
I need output like this:
asasas 12345
adab-123 123

sed ':a;N;$!ba;s/\n/ /g'
Just split it to:
asasas12345
adab-123123
And
sed ':a;N;$!ba;s/\n/ /g'
give me a:
asasas 12345 adab-123 123
Please help.
Thanks.
 
Old 11-27-2011, 10:43 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
Please use [code][/code] tags around your code, to preserve formatting and to improve readability.

As it is, I can't understand your exact requirements.
 
Old 11-27-2011, 11:30 AM   #3
grooper
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you. I found solution already.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script - remove line siegi82 Linux - Software 7 07-20-2010 07:34 AM
csh Shell Script: String Concatenation, how do i add a new line character? vxc69 Programming 1 05-04-2009 07:51 PM
Trying to use sed to remove last line if it contains a certain string. slaxative Linux - Software 1 03-18-2008 02:13 AM
Shell Script: Delete lines til string found or until particular string. bhargav_crd Linux - General 3 12-20-2007 11:14 PM
How to identify a line and replace another string on that line using Shell script? Sid2007 Programming 10 10-01-2007 08:49 PM


All times are GMT -5. The time now is 03:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration