- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- file output formatting
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
тАО06-12-2009 02:57 AM
тАО06-12-2009 02:57 AM
I want to prcess a file on output as shown below pls help me
the output of the file is like
1 nn.abc.com Reachable
2 node_name.xyz.com Reachable
3 test_node Not Reachable
instead i want the output as
1 nn.abc.com Reachable
2 node_name.xyz.com Reachable
3 test_node Not Reachable
I have a small script which will test for node reachability where the output is found to be jumbled because of the node names
pls guide me to get this required format
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:02 AM
тАО06-12-2009 03:02 AM
Re: file output formatting
>>the output of the file is like
>>1 nn.abc.com Reachable
>>2 node_name.xyz.com Reachable
>>3 test_node Not Reachable
>>instead i want the output as
>>1 nn.abc.com Reachable
>>2 node_name.xyz.com Reachable
>>3 test_node Not Reachable
I didn't find any difference between your output file and what you want.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:03 AM
тАО06-12-2009 03:03 AM
Re: file output formatting
Where is your input file ?
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:12 AM
тАО06-12-2009 03:12 AM
Re: file output formatting
I want equal spacing irespective ov the node name size.My Fields are S.No,Node Name & Status.
In this output id the nodename is short the status is printed near to that if the node name is long then the status is printed accordingly instead of this i want the output to be equally spaced like the contentes of any table.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:24 AM
тАО06-12-2009 03:24 AM
Re: file output formatting
see the below things
[root@rspc521 suraj]# cat data
1 nn.abc.com Reachable
2 node_name.xyz.com Reachable
3 test_node Not Reachable
[root@rspc521 suraj]# cat p
awk '{ printf "%-3s %-20s %s %s\n", $1,$2,$3,$4 }' data
[root@rspc521 suraj]# sh p
1 nn.abc.com Reachable
2 node_name.xyz.com Reachable
3 test_node Not Reachable
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:27 AM
тАО06-12-2009 03:27 AM
Re: file output formatting
Here you can't see the formated output
I hope you can see at your server in proper format.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:31 AM
тАО06-12-2009 03:31 AM
Re: file output formatting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:36 AM
тАО06-12-2009 03:36 AM
Re: file output formatting
>>>[root@rspc521 suraj]# cat p
awk '{ printf "%-3s %-20s %s %s\n", $1,$2,$3,$4 }' data
pls clarify this
data is my input file, that fine
Let me know how eactly i should type the above command
Also if possible pls explain the awk params
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:54 AM
тАО06-12-2009 03:54 AM
Re: file output formatting
Saw your attached file you will get the same output if you do what i said .
just open a file suppose p
paste this below line
awk '{ printf "%-s %-20s %s %s\n", $1,$2,$3,$4 }' data
save the file
now at the command prompt type make sure your input file data in the same folder
# sh p
you will get the output as you said
see the link below to know about AWK
http://en.wikipedia.org/wiki/AWK
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2009 03:59 AM