I have an input file called input.txt
like this:
powerOf|creating new file|failure
creatEd|new file creating|failure
powerAp|powerof server|failureof file
I extract the text up to just before the fist capital letter in the first field and store those snippets in output.txt
:
power
creat
I used the sed
command to separate out the values and it's working fine.
From the output file (output.txt
), I need to grep
from the first field, and output should be like below:
Power
power:powerOf|creating new file|failure,powerAp|powerof server|failureof file
creat
creat:creatEd|new file creating|failure
I have tried a few ways but I'm not getting the expected output.
I tried the following but I'm getting duplicate entries:
cat input.txt | cut -d '|' f1 >> input1.txt
cat input1.txt | s/\([a-z]\)\([A-Z]\)/\1 \2/g >> output.txt
while read -r line;do
echo $ line
cat input.txt |cut -d ‘|’ f1|grep $line >> output1. txt
done< "output.txt"
I have 20000 lines in the input file. I don’t know why I am getting duplicates the output. What am I doing wrong?