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
  Search this Thread
Old 09-21-2003, 10: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, 12:27 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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, 07: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-22-2003, 11:24 PM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

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

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

Rep: Reputation: 33
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, 05: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 01:28 PM
inserting/deleting characters into a text file ananthbv Programming 7 07-13-2004 11:40 PM
Deleting single space characters from a file NeoDaNeenjah Linux - Newbie 2 03-16-2004 02:27 AM
deleting a file via comman line PionexUser Linux - General 2 09-17-2003 12:27 AM
Deleting non ASCII characters Thinkgeekness Linux - Networking 4 03-04-2003 01:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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