awk '{for(i=1;i<=NF;i++){if($i~/^0[a-z,0-9][a-z,0-9]/){print $i}}}' test1 > test3
doWork()
{ rm /tmp/test1 && awk '{sub(/'$I'/, ""'$I'"", $0); print}' >test1;} < test1
for I in `cat /tmp/test3`
do doWork;
done;
Input text file:
/tmp # cat test1 1234 012345
0.000 01/02/03 01234 05554567 0qwertyu 0099 0000 000012
1800.000000 099000 0123456789
Current Output:
1234 ""01234"5"
0.000 01/02/03 "01234" "05554567" "0qwertyu" "0099" "0000" "000012"
1800."0000"00 "099000" ""01234"5"6789
Expected output:
1234 "012345"
0.000 01/02/03 "01234" "05554567" "0qwertyu" 0099 "0000" "000012"
1800.000000 "099000" "0123456789"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…