bash script to remove first characters from every line
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
bash script to remove first characters from every line
I downloaded bazaar.txt for a shell scripting-pdf, so that I can follow the examples I want to get rid of the margin (there are two spaces in front of every line. I've tried
sed '/^ /!d' bazaar.txt | tr -s ' ' > bazaar2.txt
but this will only remove one space, one more to go using the same method btw does not work twice. Hints, links, information and flames all appreciated.
This cuts off the range of '1-2' or in this case the range from 1 to 2 characters inclusive (the first two characters). For example it would be 5-23 if you wanted to cut off characters 5 to 23 inclusive.
-It's funny, I'm doing this so I have a file to work with to learn shell-scripting(shell-scripting.pdf)...and to get passed the 'sed' and 'tr' lessons, 'cut' would have been next! Anyway thanks texmex
HI
I'm also trying to wade throught the shellscripting.pdf book but am unable to find the files it refers to in the examples. Both the bazaar.txt and emails{1,2,3}.txt.
Can you please let me know where to download the files listed in shell-scripting.pdf? http://www.catb.org/~esr/writings/cathedral-bazaar/ does not work. I also not able to download other files, emails1.txt, emails2.txt emails3.txt columns.txt telnum.txt. I would really appreciate if someone can tell me where to get these files.
I'm trying to combine two text files and remove common phrases in each file. I've done that with
'comm -3 text1.txt text2.txt > new.txt'
But it puts them in columns so I have a column for text1 and a column for text2 so I did
'comm -3 --output-delimiter=0 text1.txt text2.txt > new.txt'
but now I have 0's in front of text2 phrases. I was wondering if there was anything I could && or | to, to remove the 0's or maybe even a better way of doing this. I would greatly appreciate any nudges in the right direction.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.