Sponsored Content
Top Forums Shell Programming and Scripting how to format a list of files from ls? Post 302363639 by ghostdog74 on Wednesday 21st of October 2009 12:34:35 AM
Old 10-21-2009
that's not quite there...yet at least. There's no option for wildcard expansion for basename the last time i checked. (if there is, then pardon me for my ignorance)
Code:
# basename  Agnes.SpeechVoice  .SpeechVoice
Agnes
# basename  *SpeechVoice  .SpeechVoice
basename: extra operand `.SpeechVoice'
Try `basename --help' for more information.
# basename  *.SpeechVoice  .SpeechVoice
basename: extra operand `.SpeechVoice'
Try `basename --help' for more information.
# basename  *.SpeechVoice
Agnes.SpeechVoice



---------- Post updated at 11:34 PM ---------- Previous update was at 10:43 PM ----------

Quote:
Originally Posted by vidyadhar85
you can do that with a simple command..
Code:
for dir_name in `ls *.SpeechVoice` ; do
basename  $dir_name .SpeechVoice
done

another way without the ls
Code:
for name in *.SpeechVoice
do
 .....
done


Last edited by ghostdog74; 10-21-2009 at 01:33 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with find command and list in a long format each found file

The purpose of those comands are to find the newest file in a directory acvrdind to system date, and it has to be recursively found in each directory. The problem is that i want to list in a long format every found file, but the commands i use produce unexpected results ,so the output lists in a... (5 Replies)
Discussion started by: alexcol
5 Replies

2. Shell Programming and Scripting

List files and display last modify time in a particular format

hi everyone, can someone suggest how i can list the contents of a directory and display their corresponding last modify time in the format yyyymmddhhmm? thanks in advance! (16 Replies)
Discussion started by: Deanne
16 Replies

3. Shell Programming and Scripting

changing the format of the list

I have a file such that List : a, b, c, d I want to list this as List a b c d however the trick is the number of arguments in the list is varies. There might be 0-7 variables . Can you help me? Please use code tags when posting data and code samples! (5 Replies)
Discussion started by: ozum
5 Replies

4. Shell Programming and Scripting

Need your help to get the output of the list in desired format

Hello Guys, I am working on a script and using the below code to fetch the list of all repositories CHDIR='/mnt/scm/subversion/' repolist() { cd ${CHDIR} Repo=`ls|cut -d " " -f1` echo $Repo } Output of the above code is BSB CIB COB DCI DIB DSB ESB-P ESB-TOOLS FareVerify GCACHE GWY... (15 Replies)
Discussion started by: rohit22hamirpur
15 Replies

5. Shell Programming and Scripting

search for content in files. Name of files is in another file. Format as report.

Hi I have multiple files in a folder and one file which contains a list of files (one on each line). I was to search for a string only within these files and not the whole folder. I need the output to be in the form File1<tab>string instance 2<tab> string instance 2<tab>string instance 3... (6 Replies)
Discussion started by: pkabali
6 Replies

6. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

7. UNIX for Dummies Questions & Answers

Rename all Files in a UNIX Directory from one date format to another date format

Hi Unix Gurus, I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies

8. Shell Programming and Scripting

Long list file display different time format.

Hi Gurus, I have some weird issue. when using ls -l the result shows different time format: -rw-r--r-- 1 abc gourp1 3032605576 Jun 14 2013 abc -rw-rw-r-- 1 abc gourp1 1689948832 Aug 10 06:22 abc one display 2013 which is year; another one displays 06:22 which is time. ... (4 Replies)
Discussion started by: ken6503
4 Replies

9. Shell Programming and Scripting

How to find list of missing files based on the file format?

Hi All, In the file names we have dates. Based on the file format given by the user, if any file is not existed for a particular date with in a given interval we should consider that file is missing. I have the below files in the directory /bin/daily/voda_files. ... (9 Replies)
Discussion started by: nalu
9 Replies

10. UNIX for Beginners Questions & Answers

Not sure how to describe it but how to format this list so that it print the 1st field once only

Hi, Not sure how to describe the problem. But basically, I have this file listing here app01_app.test.com.ph|PROGRAM=SQL Developer|HOST=AKL0TS100|USER=Admtest01|HOST=10.111.12.23| app02_app.test.com.ph|PROGRAM=D:\interface\apps\bin32\batch.exe|HOST=AKL0TS100|USER=Admtest09|HOST=10.111.12.35|... (3 Replies)
Discussion started by: newbie_01
3 Replies
wnn_hinsi.data(4)						   File Formats 						 wnn_hinsi.data(4)

NAME
wnn_hinsi.data - Wnn6 part of speech administration file SYNOPSIS
/usr/lib/locale/ja/wnn/ja/hinsi.data DESCRIPTION
hinsi.data is a file that contains information required to administer the main parts of speech. Numbers are allocated in the order of the parts of speech and composite parts of speech defined in hinsi.data. These numbers are used when creating dictionary files and part of speech files, when looking up part of speech names by numbers from the client and server, and looking up the parts of speech in composite parts of speech. Numbers are assigned in ascending order starting at 0. Only the following operations are allowed for this file: appending new parts of speech or composite parts of speech to the end of the file and replacing lines consisting of only "@" with definitions of parts of speech or composite parts of speech. NEVER DELETE ENTRIES. "@" is used to reserve lines in the file in advance when part of speech names have not yet been determined. The part of speech formats for lines in this file are as follows: part_of_speech composite_part_of_speech $ part_of_speech : part_of_speech:...:part_of_speech All parts of speech appearing in definitions of composite parts of speech must be defined before the composite part of speech can be defined. There must not be more than one part of speech or composite part of speech with the same name. Everything on a line following a semicolon (;) is treated as comment and ignored. Information on this file (looking up part of speech names from part of speech numbers and looking up the structural elements of composite parts of speech) are provided by the library and can thus be referenced through the client process. EXAMPLES
Example 1: [SENTOU] ;Beginning of a sentence [MEISHI] ;Indicates a noun. [ICHIDAN] [ICHIDANMEI]$[ICHIDAN]:[MEISHI] ;A composite part of speech @ @ NOTES
Information on the main parts of speech must be consistent between all dictionaries and connection information files. Do not edit and change hinsi.data. (If the file is changed, the meaning of the part of speech numbers in dictionaries and connection information files created with the old part of speech administration file will change.) SunOS 5.10 28 May 1998 wnn_hinsi.data(4)
All times are GMT -4. The time now is 03:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy