Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


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

Rep: Reputation: 30
how can i truncate this

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

in this i want only "1.2M"
i want only be after last "/")

can you help me please

thank you in advance
Old 06-15-2007, 11:42 PM   #2
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.

 echo '1.2M /root/Desktop/' | awk '{ print $1 }'

echo '1.2M /root/Desktop/' | cut -d/ -f4
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:12 PM.

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