I have a file as below -
vipin kumar ........................ kumar ......bangalore
something something .......
;
vipin kumar ........................ kumar ......bangalore
something something .......(testing
)
;
vipin kumar ......................... kumar .....bangalore
something something ;
I need the output as shown below (the name and number may be different in the file, but the only thing that is common is the line ends when we have ";")
vipin kumar ........................ kumar ......bangalore something something .......;
vipin kumar ........................ kumar ......bangalore something something .......(testing);
vipin kumar ......................... kumar .....bangaloresomething something ;
I want to set the RS to ";" .
I tried the commands below -
awk '{ORS=(NR%2==0?RS:FS)}1' file.txt
but he does not give the correct result because
NR%2 or NR%3 won't work as i'm not sure after how many rows i will get ;
Then I tried to install RS; using below
awk '{for(i=1;i<=NF;i++) (ORS=(if($i ~ /;/?RS:FS);break}1' file.txt
But this command does not work.
source
share