Morning, people!
I'd like to call upon your expertise again, this time for a sed endeavor.
I've already searched around the forums, didn't find anything that helped yet.
background: Solaris 9.x, it's a closed system and there are restrictions to what is portable to it. So let's assume I can't just download an updated GNU/POSIX utility.
Alright, so I've been reading some literature on Sed and I'm under the impression that it is somehow possible to embed/inject a newline in the hold space (the string replacing a pattern).
the intent was to double space some reports that we produce on weekly basis for a more eye-friendly format.
So we have a line as follows;
Group User ID Day Week End Reports Compl Hours Logged
analysis azzame Week 25APR09 13 26.0 42.7
analysis campbels Week 25APR09 26 51.2 48.2
basically, I was trying to double space lines conforming to the above format. NOTE** there are spaces in front of the lines for formatting in the actual file
so I tried a sed edit like this:
# sed 's/^ *analysis.*[0-9]$/&\
/' wkending25APR09.txt
inspiration for this comes from the following
https://www.unix.com/shell-programmin...character.html
at the bottom of this post, it appears as though embedding a newline is possible.
also, the following excerpt from the following link:
sed
"A line can be split by substituting a <newline> into it. The application shall escape the <newline> in the replacement by preceding it by a backslash. A substitution shall be considered to have been performed even if the replacement string is identical to the string that it replaces. Any backslash used to alter the default meaning of a subsequent character shall be discarded from the BRE or the replacement before evaluating the BRE or using the replacement."
Let me know your thoughts, i.e. if I'm chasing a ghost any alternatives would be greatly appreciated, I came across something like gsub function in awk?? I guess that might make it possible, however if it's possible in sed I would prefer that method purely to satisfy my knowledge curiosity.
thanks, y'all!!
ProGrammar