The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Record count problem using sed command ayanbiswas UNIX for Dummies Questions & Answers 2 07-02-2008 07:59 AM
how to read record by record from a file in unix raoscb UNIX for Dummies Questions & Answers 1 05-16-2008 06:30 AM
Usiung last record of file using 'sed' command Roopanwita Shell Programming and Scripting 5 06-29-2007 02:25 AM
command to remove last record on file mheinen UNIX for Dummies Questions & Answers 4 01-09-2007 04:39 PM
fl command - set record length Tom Siegel Shell Programming and Scripting 2 07-17-2006 09:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-28-2008
sreenusola sreenusola is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
Command nee to cut the record

I have a file which contains a record like follows

/dir1/dir2/dir3/file.dat

I need command to so that output can be only file.dat
  #2 (permalink)  
Old 08-28-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
You want the basename command.
  #3 (permalink)  
Old 08-28-2008
sreenusola sreenusola is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
i need to eliminate the path from that record and want only the file name
I think cut will be used but I appreciate if get full command with options to be used
  #4 (permalink)  
Old 08-28-2008
RahulJoshi's Avatar
RahulJoshi RahulJoshi is offline
Registered User
  
 

Join Date: Aug 2008
Location: PUNE
Posts: 98
U can try basename /dir1/dir2/dir3/file.dat
  #5 (permalink)  
Old 08-28-2008
sreenusola sreenusola is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
Hi Rahul



the basename command is not reading the file the in which records are present.



i have a file (say temp) which contains the records in the following format



dir1/dir2/dir2/file.dat

dir1/dir2/dir2/file2.dat

----

-----



so now i need to get only file names that temp file
  #6 (permalink)  
Old 08-28-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
Dont dup post please: Need a command to get part of a record from file
  #7 (permalink)  
Old 08-28-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Please don't double-post. Please continue at Need a command to get part of a record from file
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0