How can I add a string to the start of a line if the line and the next line start with numbers?
From:
random text
random text
65345
234
random text
random text
random text
random text
random text
random text
9875
789709
random text
random text
random text
To:
random text
random text
appended text 65345
234
random text
random text
random text
random text
random text
random text
appended text 9875
789709
random text
random text
random text
Adding to all lines that start with numbers is as simple as
$ printf "hello\n123\n" | sed 's/^[0-9]/appended text &/'
hello
appended text 123
No idea how to do what I am trying to do though.
"random text" might end in a number
Any ideas?