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?
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.
' 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).
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.
\" - 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.
This could work for you
echo '"4.027.160921.1";' | cut -d'"' -f 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With