LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
LinkBack Search this Thread
Old 02-09-2005, 07:58 PM   #1
jfall
Member
 
Registered: Oct 2002
Location: PEI
Distribution: Slackware
Posts: 56

Rep: Reputation: 15
How can I cut something between quotes?


Say I have grepped a file and the output is "test" -- how can I remove the quotes from it using grep, cut, awk or sed assuming that the word between quotes is not always going to be the same

Last edited by jfall; 02-09-2005 at 07:59 PM.
 
Old 02-09-2005, 08:13 PM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 46
grep <whatever> | tr -d '"' | doSomethingElse
 
Old 02-09-2005, 09:03 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Another method:
Code:
grep <whatever> | sed 's/"//g' | doSomethingElse
Like sigsegv's command, that will wipe out all double quotes in the returned value. In other words, if the string you're searching for contains a double quote (like grep 'he said, "she said"'), then the internal double quotes will get whacked too.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with quotes and double quotes Andruha Slackware 6 01-02-2010 04:44 PM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 11:41 AM
Quotes Unp Slackware 5 02-11-2005 12:24 PM
Quotes qcoder LQ Suggestions & Feedback 2 10-16-2003 10:09 PM
Quotes Rhayader LQ Suggestions & Feedback 3 04-22-2002 10:30 AM


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