Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux, How to using cut command with delimiters double quote?

Tags:

linux

cut

i have a a line of text file contain this :

$gVER = "4.027.160921.1";

how to using cut in linux to delete double quotes and also the last (;), i just want to put the numbers value only. what i already try is this :

exec( "cat /web/FunctionInit.inc.php | grep gVER | cut -d \"=\" -f2"

when i using this code the result is :

"4.027.160921.1";

how to delimiters double quotes and the last (;) using cut linux?

like image 865
yosafat Avatar asked Oct 13 '16 03:10

yosafat


People also ask

How do you cut delimiter?

To cut using a delimiter use the -d option. This is normally used in conjunction with the -f option to specify the field that should be cut.

How escape double quotes in Linux command line?

' appearing in double quotes is escaped using a backslash. The backslash preceding the ' ! ' is not removed. The special parameters ' * ' and ' @ ' have special meaning when in double quotes (see Shell Parameter Expansion).

How do you pass a string with double quotes?

The basic double-quoted string is a series of characters surrounded by double quotes. If you need to use the double quote inside the string, you can use the backslash character.

How do I print double quotes in Linux?

\" - escape sequence Since printf uses ""(double quotes) to identify starting and ending point of a message, we need to use \" escape sequence to print the double quotes.


1 Answers

This could work for you

 echo '"4.027.160921.1";' | cut -d'"' -f 2
like image 182
matesc Avatar answered Sep 28 '22 08:09

matesc