[Show all top banners]

phone_book
Replies to this thread:

More by phone_book
What people are reading
Subscribers
:: Subscribe
Back to: Computer/IT Refresh page to view new replies
 unix help plz
[VIEWED 5042 TIMES]
SAVE! for ease of future access.
Posted on 03-12-09 2:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 


#! /bin/sed -nf
H
$ {
x
s/\n//g
p
}


i found the above sed command means remove all newline characters. but can anyone plz explain me how does this command work?...thank u  


 
Posted on 03-12-09 2:53 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

#!/bin/sed -nf
H #defining a pattern space to hold something
$ { #go through all the lines in file, try putting values 4..it will parse through 4 lines only etc
x #swap pattern and hold space
s/\n//g #search new line character and replace with nothing, ie remove new line character
p #print pattern space
}

Hope it helps.

 
Posted on 03-12-09 3:06 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Not sure if this is helpful but 's/\n//g' ko 's' bhanya search for ho, ani the next '/' bhanya next command ho, '/n' represents the newline character. '//' bhanya replace with nothing ho ani 'g' bhanya global. so it means search for \n ani replace with nothing, through the text body.

For example you might have:

The quick brown fox jumps over the lazt dogs.
The quick brown fox jumps over the lazt dogs.
The quick brown fox jumps over the lazt dogs.The quick brown fox jumps over the lazt dogs.
The quick brown fox jumps over the lazt dogs.
The quick brown fox jumps over the lazt dogs.


now if u wanna change 'lazt' into 'lazy' for the whole body of text, just do ' s/lazt/lazy/g' and ure good :)

peace.


 
Posted on 03-12-09 3:36 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

thank you both for quick response. thats what exactly what i was looking for


thank you again


 
Posted on 03-22-09 9:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Looks pretty good explanation. What book do you guys recommend for new scripter!!!

 
Posted on 03-23-09 12:08 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

peacesoul, i RTFM most of the time and search google for more tips. Hope that helps..

 
Posted on 03-23-09 2:01 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 






 

#!/bin/sed -nf
H #defining a pattern space to hold something
$ { #go through all the lines in file, try putting values 4..it will parse through 4 lines only etc
x #swap pattern and hold space
s/\n//g #search new line character and replace with nothing, ie remove new line character
p #print pattern space
}
hope this works brother

what u do n where u works

i mdoing kick start help me bikashbha@yahoo.com

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 200 days
Recommended Popular Threads Controvertial Threads
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
शीर्षक जे पनि हुन सक्छ।
What are your first memories of when Nepal Television Began?
Sajha Poll: नेपालका सबैभन्दा आकर्षक महिला को हुन्?
ChatSansar.com Naya Nepal Chat
NRN card pros and cons?
Basnet or Basnyat ??
निगुरो थाहा छ ??
Nas and The Bokas: Coming to a Night Club near you
TPS Re-registration
अमेरिकामा छोरा हराएको सूचना
ओच्छ्यान मुत्ने समस्या ( confession )
Returning to Nepal with us citizenship. Property ownership
Do nepalese really need TPS?
TPS Re-registration case still pending ..
Drawback for applying NRN card
Breathe in. Breathe out.
nrn citizenship
Democrats are so sure Trump will win
My facebook archive (for sale)
Nas and The Bokas: Coming to a Night Club near you
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
Harvard Nepali Students Association Blame Israel for hamas terrorist attacks
TPS Update : Jajarkot earthquake
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters