Sponsored Content
Top Forums Shell Programming and Scripting Add filenames to top of each files in a directory Post 302997713 by baris35 on Thursday 18th of May 2017 12:07:53 PM
Old 05-18-2017
Hello Ravinder,
Thanks for your answer,
it gives error for some reason:

Code:
line 5: $file".tmp": ambiguous redirect

Hello Corona,
Thanks for the answer, that is working as expected.


Many Thanks!
Boris
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping thru filenames in a directory

Hi, i am very new to UNIX, i am trying to loop thru the files in a directory. I got the filenames into a variable using $files=`ls` Here $files will contain <filename1> <filename2> <filename3> I want to get one filename at a time and append it to some some text. forexample, ... (1 Reply)
Discussion started by: silas.john
1 Replies

2. 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

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

Adding characters at the top of all files in directory

Hi Unix experts; I have 30000 files in a directory and am willing to do the following changes on each of them. The input files look like the following: 1 , 2 3 , 4 5 , 6 7 , 8 9 , 10 the output will have # in top 10 lines, insert space instead of comma. This looks like: ... (4 Replies)
Discussion started by: nxp
4 Replies

5. Shell Programming and Scripting

Use filenames to create directory.

I have many files similar to this one: AC41_AC85_86_AC128_129_MC171_173_SF_207_FMV.pdf. I want a directory named AC41 and to put the file AC41_AC85_86_AC128_129_MC171_173_SF_207_FMV.pdf into the directory. Next, a directory named AC85 and put the file into it. Also, continue to cycle through... (1 Reply)
Discussion started by: ndnkyd
1 Replies

6. UNIX for Dummies Questions & Answers

Filenames change in a directory

Hi I have abc_ahb_one.v abc_ahb_two.v abc_ahb_three.v ........l like this -----upto abc_ahb_ninety.v in some directory. I need to change those file names to like below. ... (5 Replies)
Discussion started by: praneethk
5 Replies

7. Shell Programming and Scripting

[awk] print all filenames in directory

Hello, I was given a (I suppose) a simple task which I don't know how to do. Before coming here I have read a dozen of awk tutorials (full read, not just line-skipping) but I still don't know how to do this. Task: Write an script file 'check.awk' with a parameter current directory that... (5 Replies)
Discussion started by: c0dehunter
5 Replies

8. Shell Programming and Scripting

Printing filenames in my current directory

Can someone give me a tip on writing a script that, for each file in the working directory, prints the filename, the # of lines, and the # of words to stdout? (2 Replies)
Discussion started by: flash123
2 Replies

9. 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

10. 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
Mail::Server::IMAP4::List(3pm)				User Contributed Perl Documentation			    Mail::Server::IMAP4::List(3pm)

NAME
Mail::Server::IMAP4::List - folder related IMAP4 answers SYNOPSIS
my $imap = Mail::Server::IMAP4::List->new ( folders => $folders # Mail::Box::Identity , inbox => $inbox # Mail::Box , delimiter => '#' ); my $imap = Mail::Server::IMAP4::List->new(user => $user); print $imap->list(...); # for LIST command METHODS
Constructors Mail::Server::IMAP4::List->new(USER) Create a (temporary) object to handle the LIST requests for a certain user, based upon a set of folders. The data is kept by Mail::Box::Identity and Mail::Box::Collection objects, which mean that the folders will not be opened to answer these questions. -Option --Default delimeter '/' folders <from user> inbox <from user> user <undef> delimeter => STRING|CODE Either the constant delimiter, or a code reference which will get passed a folder name and should return the delimiter string used in that name. If that folder name is empty, the default delimiter must be reported. See delimiter() for an example. folders => OBJECT You need to specify either a set of folders explicitly or via the user. Some Mail::Box::Identity OBJECT is needed. inbox => BOOLEAN For now, only used to see whether there is an inbox, so a truth value will do. This may change in the future. By default, the flag is set if "$user-"inbox> is defined. user => OBJECT A Mail::Box::Manage::User OBJECT, representing the user who's folders must get reported. Attributes $obj->delimiter([FOLDERNAME]) Returns the delimiter string. The foldername is only required when a CODE reference was specified at initiation. example: setting-up an IMAP4 delimeter sub delim($) { my $path = shift; my ($delim, $root) = $path =~ m/^(#news.)/ ? ('.', $1) = $path =~ m!^/! ? ('/', '/') : ('/', ''); wantarray ? ($delim, $root) : $delim; } my $list = Mail::Server::IMAP4::List->new(delimiter => &delim, ...); print $list->delimiter('abc/xyz'); # returns a / (slash) and '' print $list->delimiter('#news.feed'); # returns a . (dot) and $news. print $list->delimiter(''); # returns default delimiter $obj->folders() Returns the Mail::Box::Identity of the toplevel folder. $obj->inbox() Returns the Mail::Box or filename of the INBOX. $obj->user() Returns the Mail::Box::Manage::User object, if defined. IMAP Commands $obj->list(BASE, PATTERN) IMAP's LIST command. The request must be partially decoded, the answer will need to be encoded. example: using IMAP list my $imap = Mail::Server::IMAP4::List->new(delimiter => &delim, ...); local $" = ';'; my @lines = $imap->list('', ''); # returns the default delimiter print ">@{$lines[0]}<"; # >(Noselect);/;< my @lines = $imap->list('#news',''); # specific delimiter print ">@{$lines[0]}<"; # >(Noselect);.;< my @lines = $imap->list('top/x/', '%'); print ">@$_<," foreach @lines; # >();/;/tmp/x/y<,>(Marked);/;/tmp/x/z< DETAILS
See RFC2060: "Internet Message Access Protocol IMAP4v1" sections 6.3.8 (LIST question) and 7.2.2 (LIST answer) SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/ LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-05-07 Mail::Server::IMAP4::List(3pm)
All times are GMT -4. The time now is 07:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy