- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Cut first column
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
Forums
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
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
04-02-2006 05:16 PM
04-02-2006 05:16 PM
Cut first column
vi test.txt
111:dfsaf
222:fdsfdsa
333:fsafas
444:fdsafdsaf
the output as below,
111
222
333
444
what can I do ? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2006 05:42 PM
04-02-2006 05:42 PM
Re: Cut first column
With the command awk and setting the separator caracter to ":"
cat test.txt|awk -F\: '{print $1}'
Hope this helps
Kenavo
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2006 05:44 PM
04-02-2006 05:44 PM
Re: Cut first column
you can use awk to do this.
awk -F ":" '{print $1}' test.txt
Cheers!!
sysadm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2006 05:55 PM
04-02-2006 05:55 PM
Re: Cut first column
cat test.txt | awk -F: '{ print $1}'
111
222
333
444
-Siddhartha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2006 08:45 PM
04-02-2006 08:45 PM
Re: Cut first column
please read :
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
You have assigned 0 points to 62 answers !!
"Although assigning points is not mandatory, it is a key component of a strong, interactive community, and it is STRONGLY ENCOURAGED. Others have taken time to help you, so please take a moment to give them credit for their assistance!"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2006 02:11 AM
04-03-2006 02:11 AM
Re: Cut first column
Check out: man cut
cut -d: -f1 test.txt > output.txt
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2006 07:41 PM
04-03-2006 07:41 PM
Re: Cut first column
if the separator will be always ":" you can use:
cut -d":" -f1 test.txt
if the separator will changebut teh size of teh column will be fixed you can use:
cut -c 1-3 test.txt
man cut for more info.
HTH,
Art