How to extract only certain part from string?
Hi,
I want to know how I can extract only certain part from string? For Example I want to extract only "UpToDate" after "/" from "ds:UpToDate/UpToDate"? Quick Replies are highly appreciated. |
Try:
Code:
awk -F="/" '{print $2}' infile.txt |
And what have you tried? What language (bash, perl, awk, etc) are you trying to use?
|
How to extract only certain part from string?
grail: I am using bash and also using awk.
shivaa: Your suggested method is not working. |
Quote:
Anyway, once mention sample input data or file and what you've tried, so then people can suggest you appropriate solutions. |
Quote:
Try this: cat file.txt | cut -d":" -f2 | cut -d"/" -f2 FYI: assuming the string provided is the content of file.txt It's a lengthy one but should work. |
Quote:
Code:
cut -d"/" -f2 file.txt |
All times are GMT -5. The time now is 09:42 AM. |