I'm trying to create a BASH script to extract fragments of text from a file that has many lines similar to this one:
"11","category/subcategory/sub-subcategory/item-1","index.php?option=com_trombinoscopeextended&Itemid=125&lang=es&view=trombinoscope","251","0","0000-00-00","","","","","","","0"
From each line I only have to keep the:
category/subcategory/sub-subcategory/item-1
The context can be deleted. I was trying using sed but I can't find a way to do that. I don't understand how create a command using the regular expression that I already have:
\w+(\/[\w-]+)+
I have been reading and already tried this command and other similar ones but I don't know much about this:
cat file.txt | sed -i -E "s/\w+(\/[\w-]+)+"
That definitely is not working and I can't find a beginners guide on how to use sed and regular expressions.
awk -F, '{print $2}' input
– jesse_b Apr 21 '18 at 21:23awk -F, '{print $2}' input | tr -d '"'
– jesse_b Apr 21 '18 at 21:50