LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2007, 11:12 PM   #1
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Rep: Reputation: 30
how can i truncate this


hi all
how can i truncate this...
1.2M /root/Desktop/123rwewv.zip(this path may varies)

in this i want only "1.2M"
and
i want only 123rwewv.zip(must be after last "/")

can you help me please

thank you in advance
 
Old 06-15-2007, 11:42 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Is that the output of a command or a record in a file?

You could use cut, or sed or awk.

Code:
 echo '1.2M /root/Desktop/123rwewv.zip' | awk '{ print $1 }'
1.2M

echo '1.2M /root/Desktop/123rwewv.zip' | cut -d/ -f4
123rwewv.zip
These are just two possible solutions of many. By the way, please capitalize the word "I". It is rude to use IM speak in a forum entry. Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i truncate this munna_dude Programming 24 04-12-2007 03:44 AM
Truncate A File Dovetails Linux - Newbie 2 10-22-2005 06:58 PM
Should I truncate an inode? akurtis Red Hat 0 08-02-2004 09:34 PM
how to use truncate sureshbabu Linux - Newbie 1 10-29-2003 04:22 AM
truncate command butthead Linux - General 1 05-14-2002 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration