how to grep doi from RTF file 1

how to grep doi from RTF file

cat Bib.rtf | sed -e 's/doi:/\'$'\n/g' | grep "^[0-9]" | sed -r "s/.{3}$//" > new.txt
				^ add new lines			^begin with numbers	 ^remove last 3 characters 			

Here is what the above code is Doing:
1. The first line is taking the Bib.rtf file and piping it to sed.
2. The second line is telling sed to replace all instances of “doi:” with a new line.
3. The third line is telling grep to only print lines that begin with a number.
4. The fourth line is telling sed to remove the last three characters of each line.

Similar Posts