Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 02-09-2005, 07:58 PM   #1
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
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
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Another method:
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.


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

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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration