----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
In fact, if you want a space only before the joined line:
awk 'NR>1{printf ($0~/cn=/?" ":"\n")}{printf "%s",$0}END{printf "\n"}' /path/to/input >output
However, now I need to put this into a perl script & I am having issues with getting it to work. I have tried backticks, qq etc. and no good. Any ideas how to make this work within a perl script?
I run this ->
my $tmpfile_2 = qq|/tmp/somefile2.bak|;
my $awk_cn_command = qq|awk 'NR>1 && !/cn=/{printf '"\n"'}{printf '"%s"',$0}END{printf '"\n"'}' $logout > tmpfile_2|;
print $awk_cn_command;
qx|$awk_cn_command|;
and the output I get is;
awk 'NR>1 && !/cn=/{printf '"
"'}{printf '"%s"',./login_errors.pl}END{printf '"
"'}' /tmp/failure.log > tmpfile_2awk: syntax error near line 2
awk: illegal statement near line 2
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.