I have a sample file with '|| o || ' as a field separator.
www.google.org||o||srScSG2C5tg=||o||bngwq farhansingla.it||o||4sQVj09gpls=||o|| ngascash||o||||o|| ms-bronze.com.br||o||||o||
I want to move lines with only one field in 1.txt and with more than 1 field in not_1.txt . I use the following command:
sed 's/\(||o||\)\+$//g' sample.txt | awk -F '[|][|]o[|][|]' '{if (NF == 1) print > "1.txt"; else print > "not_1.txt" }'
The problem is that it does not move the original rows, but replaced ones.
The output I get is (not_1.txt):
td@the-end.org ||o||srScSG2C5tg=||o||bnm erba01@tiscali.it ||o||4sQVj09gpls=
1.txt:
ngas ms-inside@bol.com.br
As you can see, the source lines are changed. I do not want to change the lines. Any help would be greatly appreciated.
source share