LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-21-2006, 07:28 AM   #1
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Rep: Reputation: 30
display only certain chars in each line


hello,
I have one text and i to print each line in that text again upto one word. what should i use? how can i do?
ex. text is say
Code:
     I like linux
     you like linux
     everyone like linux
then output must be
Code:
        I like
        you like
        everyone like
 
Old 02-21-2006, 08:07 AM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Code:
sed 's/ linux//' filename
Is that you have requested, sorry if I am misunderstood.
 
Old 02-21-2006, 02:03 PM   #3
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
or you could use `cut` to chop off the last word..

man cut

of course there is about a dozen other solutions also..
 
  


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
linux command : read/display the line n xeebeeeeeee Programming 3 03-26-2006 05:08 AM
Display line number n from a file doctorwebbox Linux - Newbie 2 01-05-2005 02:06 PM
how many chars can be displayed in a line? williamjxj Linux - Software 1 10-25-2004 03:24 AM
Modifing Gnome display from command line rooch84 Linux - Software 2 08-10-2004 09:10 AM
Change bytes display on command line Shinobi Linux - General 3 06-04-2003 09:03 AM


All times are GMT -5. The time now is 04:44 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
Open Source Consulting | Domain Registration