LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
 
Search this Thread
Old 09-21-2003, 11:41 PM   #1
poobeany
LQ Newbie
 
Registered: Aug 2003
Distribution: RH9
Posts: 4

Rep: Reputation: 0
deleting characters at the beginning of a line


im not sure if this is the place for this, but oh well. here is what im trying to do. i have a list that is in this format:

(423) smokeywrz
(407) Wonderbox
(359) Dark Sian
(347) ScorpioNinja

im trying to delete everything in the parentheses (and the parentheses themselves) so im left with just the names. is there a command that i can use to delete the first few characters in every line? i tried tr and sed, but i failed. basically, im just really confused
 
Old 09-22-2003, 01:27 AM   #2
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
You can try with cut, but YMMV with your understanding. I believe this might live better in "programming", however I'll leave it up to you whether it gets moved or not (simply reply with your request).

Cool
 
Old 09-22-2003, 08:33 PM   #3
poobeany
LQ Newbie
 
Registered: Aug 2003
Distribution: RH9
Posts: 4

Original Poster
Rep: Reputation: 0
yeah, that would be cool if you moved it. i tried with cut, but it always says this:

cut: invalid byte, character or field list
Try `cut --help' for more information.

im not sure the syntax, even though it says in the man pages. if i wanna remove (423) and stuff like it, i would use (*) right? but im not sure how to do that, and i tried as many combinations of things i could. thanks.
 
Old 09-23-2003, 12:24 AM   #4
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Cool:
Moving to Programming
 
Old 09-23-2003, 02:03 AM   #5
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 32
cat file | awk 'BEGIN{FS=")"}{print $2}'
 
Old 09-23-2003, 02:36 AM   #6
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 32
Quote:
Originally posted by poobeany
yeah, that would be cool if you moved it. i tried with cut, but it always says this:

cut: invalid byte, character or field list
Try `cut --help' for more information.

im not sure the syntax, even though it says in the man pages. if i wanna remove (423) and stuff like it, i would use (*) right? but im not sure how to do that, and i tried as many combinations of things i could. thanks.
cat file | cut -d ")" -f2

THis works fine
 
Old 09-23-2003, 06:17 PM   #7
poobeany
LQ Newbie
 
Registered: Aug 2003
Distribution: RH9
Posts: 4

Original Poster
Rep: Reputation: 0
thanks a ton guys
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
51 characters only in the 1st Line of command line eggCover Linux - General 2 07-29-2004 02:28 PM
inserting/deleting characters into a text file ananthbv Programming 7 07-14-2004 12:40 AM
Deleting single space characters from a file NeoDaNeenjah Linux - Newbie 2 03-16-2004 03:27 AM
deleting a file via comman line PionexUser Linux - General 2 09-17-2003 01:27 AM
Deleting non ASCII characters Thinkgeekness Linux - Networking 4 03-04-2003 02:29 PM


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

Main Menu
Advertisement
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