hi I made this simple script to extract data and pretty much is a list and would like to extract data of two words separated by commas and I would like to make a new text file that would list these extracted data into a list and each in a new line.
Example that worked for me with text file having 3 fields only:
#!/bin/bash
IFS=", "
while read f1 f2 f3
do
echo "$f1"
echo "$f2"
echo "$f3"
done < test2.txt > output.txt
and output.txt shows this
cheek
gingivae
hard
palate
inferior
lip
soft
palate
superior
lip
tongue
uvula
cat test2.txt
shows this:
cheek, gingivae, hard,
palate, inferior, lip,
soft, palate, superior
lip, tongue, uvula
BUT NOW I have a list with more fields and have two words that I need:
new test2.txt shows this:
right, kidney, right ureter,
urethra, urinary, bladder,
left, adrenal gland, abdominal aorta, inferior vena cava, right renal vein, right renal artery, rectum, uterus
how can I list these 2 word terms into a list with each in its own individual line
THANKS!