LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can I cut something between quotes? (https://www.linuxquestions.org/questions/linux-general-1/how-can-i-cut-something-between-quotes-288330/)

jfall 02-09-2005 07:58 PM

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

sigsegv 02-09-2005 08:13 PM

grep <whatever> | tr -d '"' | doSomethingElse

Dark_Helmet 02-09-2005 09:03 PM

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.


All times are GMT -5. The time now is 02:05 AM.