- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- file content allignment
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
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
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
05-29-2012 12:40 AM
05-29-2012 12:40 AM
file content allignment
I have a file , the content is as below
00 15 * 8 * /bin/chmod 755 /tmp
00 17,20 * 9 1 /bin/runcron
Now , I would like to allign it by space , the output is as the attachment file "output.txt" .
I have the below command , it is OK but it do the whole file , what I would like is to allign the first 5 column ( the date and time column ) , can advise how can i do it ? thx
cat <file> | tr "[:space:]" "\t"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2012 06:24 AM - edited 05-29-2012 07:11 PM
05-29-2012 06:24 AM - edited 05-29-2012 07:11 PM
Re: file content alignment (crontab)
>what I would like is to align the first 5 columns (the date and time columns)
Perhaps using sed:
sed -e 's/^\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \(.*$\)/\1\t\2\t\3\t\4\t\5\t\6/' file
(Where the "\t" should be replaced by a tab char.)
This assumes one space between each field. It would be simple to handle multiple spaces.