- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk report help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 06:03 AM
тАО08-04-2008 06:03 AM
I'm trying to print a report from a text file using awk. Following is an example of my current output.
Application1: Application2: Application3:
tes1 test2 test3
test1 test2 test3
test2 test3
test2 test3
Following is the output I would like to have.
Application1: Application2: Application3:
tes1 test2 test3
test1 test2 test3
test2 test3
test2 test3
I appreciate all help.
Thanks,
JC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 06:08 AM
тАО08-04-2008 06:08 AM
Re: awk report help
So where's the *input*? You current output looks like the desired output, too!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 06:44 AM
тАО08-04-2008 06:44 AM
Re: awk report help
The format did not display correctly.
Output I'm looking for excluding the (.....)
Apps1: Apps2: Apps3:
test1 test2 test3
test1 test2 test3
.......test2 test3
.......test2 test3
.......test2 test3
.............test3
.............test3
Thanks,
JC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 06:49 AM
тАО08-04-2008 06:49 AM
Re: awk report help
You still haven't provided the *input*. A sample or attachment is needed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 06:58 AM
тАО08-04-2008 06:58 AM
Re: awk report help
Yes, leading and multiple blanks are stripped unless you check the "Retain format" box.
You still may have to attach some files.
>Output I'm looking for excluding the (.....)
You want to indent your output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 07:30 AM
тАО08-04-2008 07:30 AM
Re: awk report help
Attach txt file have the output format I'm looking for.
Each column is a separate file that I combine and want to generate one report.
Thanks,
JC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 08:21 AM
тАО08-04-2008 08:21 AM
Solution> Each column is a separate file that I combine and want to generate one report
It appears that a simple 'paste' will accomodate your neeeds:
# paste -d" " file1 file2 file3
...or if you like well-formatted output:
# pr -t -m file1 file2 file3
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2008 08:38 AM
тАО08-04-2008 08:38 AM
Re: awk report help
my solution assumes
- the first line of input is a header line, which defines the total number of columns and the width of its columns
- columns may be of differnt sizes
- if the number of fields in a column is less than the header line defines, they get filled from column 1 on.
- I use a dot as filler, to get a better readable output here - just change
gsub(".",".",filler[i])
to
gsub("."," ",filler[i]) to get spaces.
as well as
...=out[num-NF+i]"."
to
...=out[num-NF+i]" "
awk 'NR==1 {for(i=1;i<=NF;i++) {filler[i]=$i;gsub(".",".",filler[i])}
num=NF; print; next}
{if(! NF) {print;next}
for (i=NF;i>0;i--) {out[num-NF+i]=$i; for(k=length(filler[i])-length($i);k;k--)out[num-NF+i]=out[num-NF+i]". "}
for(j=1;j<=num-NF;j++) out[j]=filler[j]; for(i=1;i
of
cat your-infile
Application1: Applicati2: Applica3:
test1 test2 test3
test1 test2 test3
test2 test3
test2 test3
test3
leads to
Application1: Applicati2: Applica3:
test1........ test2...... test3....
test1........ test2...... test3....
............. test2...... test3....
............. test2...... test3....
............. ........... test3....
mfG Peter