This post may be looked upon as a followup to a previous post.
This is input file:
module ABC
x(a,b,c)
module DEFG
y(d,e,f,
g,h,i)
module HIJKL
z(j,k,l)
And output file should be:
module ABC x(a,b,c)
module DEFG y(d,e,f,
g,h,i)
module HIJKL z(j,k,l)
I tried using asterisk as a wildcard character in the solutions provided in the referenced post but it did not work as expected.
Addendum
Upon closer examination I found out that indeed the solutions provided earlier work for me as well (as pointed out by @steeldriver). The problem was that the file originated from a DOS/Windows platform and there was an unexpected ^M
character that got inserted into the output, which was messing up down-the-line processing for me. I have now run dos2unix on the input file and the problem has gone away (i.e. the previous solutions work for me as well).
I am recommending that this post be closed as duplicate.
sed '/^module/N;s/\n//'
? – steeldriver Dec 18 '20 at 17:44