Matching double quotes "
Code:
Dhcp Server 190.21.12.50 add scope 190.21.12.0 255.255.255.0 "New York" "" Code:
grep "add scope" file | cut -d" " -f6,7 Thanks & Regards, |
Code:
grep "add scope" file | cut -d'"' -f2 |
awk -F\" '{print $2}' file
or awk -F\" '{print $2,$4}' file To match the contents of the second double quotes |
Thanks for the input but is it possible to accomplish this in one line.
I guess I could run it thru twice then combine the output. Quote:
|
How about:
Code:
sed -r '/add scope/s@.*scope ([^ ]+) ([^ ]+) "([^"]+)".*@\1/\2 \3@' file |
Using awk (as previously suggested by sycamorex):
Code:
$ awk -F\" '/add scope/{n = split($1,_," "); printf "%s/%s %s\n", _[6], _[7], $2}' file |
Quote:
|
Thanks guys. I will need to study both sed and awk solutions.
|
All times are GMT -5. The time now is 06:55 PM. |