![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extracting date from a filename | laiko | UNIX for Dummies Questions & Answers | 7 | 11-25-2008 03:24 PM |
| mv Filename variable to another filename | gzs553 | Shell Programming and Scripting | 3 | 04-14-2008 05:19 PM |
| shortcut for tar cvf - [filename] | gzip > [filename].tar.gz | bcamp1973 | UNIX for Dummies Questions & Answers | 4 | 12-11-2007 05:45 PM |
| Extracting Filename from Fullpath | njoshi | UNIX for Dummies Questions & Answers | 3 | 04-19-2007 06:34 PM |
| extracting from tar.bz2 | Raom | UNIX for Advanced & Expert Users | 1 | 03-07-2006 10:33 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
extracting only the filename without its extenstion
Hi,
I have a requirement that i need to store only the filename without its extension. Can anyone please help me to do this. For Example, i have stored the filename in a varialble called fname. I need to extract all the charecters before the first occurence of the dot. If fname has value as PG_0008_20050519.xml.gz then i need to extract only "PG_0008_20050519". Please help me to do this. TIA. |
|
||||
|
some more ways
the first is one with awk echo `basename <program-path>` | awk -F"." '{print $1}' this one is with sed but no of characters in extension need to be known in prior for 3 character extension echo `basename <program-path>` | sed -e 's/\....//' advancement to the above method, no of characters in extension need not be known echo `basename <program-path>` | sed -e 's/\..*//' |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|