Sponsored Content
Top Forums Shell Programming and Scripting How to take the filenames from a directory and store into a file?? Post 302841733 by RavinderSingh13 on Thursday 8th of August 2013 12:38:23 AM
Old 08-08-2013
Hello,

Could you please use the following code. We are saving file names into a file named filelist as follows.

Code:
 
 ls -ltr | grep '^-' | awk '{print$9}' > filelist

You will get the following Ouptut in a file named filelist.

Code:
 
$ cat filelist
without_length_70_lines
value_braces
to_find_min_and_max_number
timings_file_query.ksh
timings_file_query
test_data
test_chumma1
test5
test4
test13
test1212
test1211
test121
test11
test1
test.ksh



Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

concatenating the filenames in a directory

hi all, I have a requirement where in i have to read all the filenames based on a pattern from a directory and concatenate all these file names and write it to another file. i am using the following code to do this var1='' for filename in $_DIR/${FILE_NAME}* do if if then... (7 Replies)
Discussion started by: nvuradi
7 Replies

2. Shell Programming and Scripting

Replacing string in all instances (both filenames and file contents) in a directory

Hi, I have a set of files stored in a single directory that I use to set parameters for a physics code, and I would like to streamline the process of updating them all when I change a parameter. For instance, if the files are called A2000p300ini, A2000p300sub, A2000p300run, and the text in each... (3 Replies)
Discussion started by: BlueChris
3 Replies

3. Shell Programming and Scripting

Change all filenames in a directory

I have a directory of files and each file has a random 5 digit string at the beginning that needs to be removed. Plus, there are some files that will be identically named after the 5 digit string is removed and I want those eliminated or moved. any ideas? (17 Replies)
Discussion started by: crumb
17 Replies

4. Shell Programming and Scripting

New file should store all the 7 existing filenames and their record counts and ftp th

Hi, I need help regarding below concern. There is a script and it has 7 existing files(in a path say,. usr/appl/temp/file1.txt) and I need to create one new blank file say “file_count.txt” in the same script itself. Then the new file <file_count.txt> should store all the 7 filenames and... (1 Reply)
Discussion started by: pr293
1 Replies

5. Shell Programming and Scripting

How to get filenames in a directory and write them in to a file?

I need to get the names of files which are starting with a string testfile. Also i want to create a XML file in the same location and write these file names into the XML. Ex: <path> <dir> <file>testfile1</file> </dir> <dir> <file>testfile2</file> </dir>... (4 Replies)
Discussion started by: vel4ever
4 Replies

6. Shell Programming and Scripting

print all filenames in directory with path to another file

hi, i have a directory at /path/unix with the following files 1.txt 2.txt 3.txt 4.txt I want to make another file called filenames.txt at a different location called /path/home. So, my output file would be /path/home/filenames.txt with contents /path/unix/1.txt... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

7. Shell Programming and Scripting

There are multiple filenames in the directory.How to return the the lastest files for each file name

there are mutiple file nams in the directory. How to return the the lastest files for each file name. ex. abc1234_050201 abc1234_050206 abc1234_050208 xyz34_050204 xyz34_050210 xyz34_050218 thanks (4 Replies)
Discussion started by: grand_sam
4 Replies

8. Shell Programming and Scripting

Store filenames for wget in bash

I have a bash that downloads a list of files as a text file using wget. What I now need to do is store those files names and pass them to a download call also using wget. List.txt in /home directory FilterDuplicates.html file1.bam file2.bam file3.bam file1.vcf.gz file2.vcf.gz... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

How do I custom sort the files in a directory using the filenames in a text file.?

Hi all, (5 Replies)
Discussion started by: KMusunuru
5 Replies

10. UNIX for Beginners Questions & Answers

How to manipulate a text file and store each version for every changes in a directory?

I attached both picturehttps://1drv.ms/t/s!Aoomvi55MLAQh1jODfUxa-xurns_ and *.txt file of a sample work file. In this file Reactions which only start with "r1f", "r2f", "r3f"......and so on. And for each reaction the reaction rates is situated couple of lines later with a "+" sign. For each... (1 Reply)
Discussion started by: Atta
1 Replies
Select(3)						User Contributed Perl Documentation						 Select(3)

NAME
podselect - function to extract selected sections of pod documentation SYNOPSIS
use PDL::Pod::Select; podselect (@filelist); podselect ({OUTPUT => "tmp.out"}, @filelist): podselect ({SELECT => ["NAME|SYNOPSIS", "OPTIONS"]}, @filelist): podselect ({OUTPUT => ">&STDERR", SELECT => ["DESCRIPTION"]}, "-"); DESCRIPTION
podselect() is a function which will extract specified sections of pod documentation from an input stream. This ability is already provided in the PDL::Pod::Parser module. Subclasses of PDL::Pod::Parser that wish to take advantage of this feature do not need to derive from PDL::Pod::Select. PDL::Pod::Select merely provides a single function named podselect() which provides this capability in function form (as opposed to object form) for extracting the raw pod docs. podselect(\%options, @filelist) podselect will print the raw (untranslated) pod documentation of all pod sections in the given input files specified by @filelist according to the given options. If any argument to podselect is a reference to a hash (associative array) then the values with the following keys are processed as follows: "OUTPUT" A string corresponding to the desired output file (or ">&STDOUT" or ">&STDERR"). The default is to use standard output. "SELECT" A reference to an array of sections specifications (as described in "SECTION SPECIFICATIONS" in PDL::Pod::Parser) which indicate the desired set of pod sections and subsections to be selected from input. If no section specifications are given, then all sections of pod documentation are used. All other arguments should correspond to the names of input files containing pod documentation. A file name of "-" or "<&STDIN" will be interpeted to mean standard input (which is the default if no filenames are given). SEE ALSO
PDL::Pod::Parser AUTHOR
Brad Appleton <Brad_Appleton-GBDA001@email.mot.com> Based on code for pod2text written by Tom Christiansen <tchrist@mox.perl.com> perl v5.12.1 2009-10-17 Select(3)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy