Hi,
I have input which reads like
9089.00 ----- kl jkjjljk lkkk; (909099) 9097.00 ----- HGJJHHJ jcxkjlkjvhvlk jhdkjksdfkhfskd 898.00 ----- HHHH
I am trying to do something like this - As soon as I found pattern match "XYZ.00-----" it will insert a line break to the input and will go to next line and print like below
op
9089.00 ----- kl jkjjljk lkkk; (909099)
9097.00 ----- HGJJHHJ jcxkjlkjvhvlk jhdkjksdfkhfskd
898.00 ----- HHHH
Thanks
something to start with:
awk '{gsub("[0-9][0-9]*[.]00",RS "&");print}' myFile
1 Like
sed "s/\([0-9]*\.00\)/\n\1/g" input.txt
The above command will work with some versions of sed
, but the standards don't say anything about the replacement string in a sed
substitute command converting \n
to a <newline> character in the output. Note also that the above command will also insert a <newline> (or on systems that don't convert \n
to a <newline>, an n
) at the start of the output. The following command won't insert anything at the start of the output and should work with any version of sed
:
sed 's/ \([0-9]*\.00 \)/ \
\1/g' input.txt
where there is nothing but a<newline> character immediately after the backslash at the end of the 1st line of the above command.
1 Like