Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Cat file a to *.xls files (http://www.velocityreviews.com/forums/t902849-cat-file-a-to-xls-files.html)

Jim 04-26-2007 08:30 PM

Cat file a to *.xls files
 
Hi I'm trying to get a perl script to work without much luck.

What I'm trying to do is to:

cat filea.txt to all .xls files in a directory

your help would be appreciated

Thanks in advance


Mirco Wahab 04-26-2007 08:48 PM

Re: Cat file a to *.xls files
 
Jim wrote:
> Hi I'm trying to get a perl script to work without much luck.
> What I'm trying to do is to:
> cat filea.txt to all .xls files in a directory


Are you Jim the Italian living in French
Canada trying to write English?

(I didn't understand anything)

What's meant by 'cat' here? Can you explain?

Regards

M.

Tad McClellan 04-26-2007 10:54 PM

Re: Cat file a to *.xls files
 
Jim <grace.jim@gmail.com> wrote:
> Hi I'm trying to get a perl script to work without much luck.
>
> What I'm trying to do is to:
>
> cat filea.txt to all .xls files in a directory
>
> your help would be appreciated



No Perl needed, just use the shell!


# untested
for file in *.xls; do
cat filea.txt >>$file
done


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

tuser 04-26-2007 10:57 PM

Re: Cat file a to *.xls files
 
On Apr 27, 12:54 am, Tad McClellan <t...@augustmail.com> wrote:
> Jim <grace....@gmail.com> wrote:
> > Hi I'm trying to get a perl script to work without much luck.

>
> > What I'm trying to do is to:

>
> > cat filea.txt to all .xls files in a directory

>
> > your help would be appreciated

>
> No Perl needed, just use the shell!
>
> # untested
> for file in *.xls; do
> cat filea.txt >>$file
> done


in Perl (untested):
system("cat filea.txt >>$_") for glob "*.xls";


Jim 04-27-2007 01:28 PM

Re: Cat file a to *.xls files
 
On Apr 26, 6:54 pm, Tad McClellan <t...@augustmail.com> wrote:
> Jim <grace....@gmail.com> wrote:
> > Hi I'm trying to get a perl script to work without much luck.

>
> > What I'm trying to do is to:

>
> > cat filea.txt to all .xls files in a directory

>
> > your help would be appreciated

>
> No Perl needed, just use the shell!
>
> # untested
> for file in *.xls; do
> cat filea.txt >>$file
> done
>
> --
> Tad McClellan SGML consulting
> t...@augustmail.com Perl programming
> Fort Worth, Texas


Thanks Tad, it worked nicely but, what I need is to have the contents
of filea.txt at the start of the .xls files. Is this possible to do?


Jürgen Exner 04-27-2007 01:56 PM

Re: Cat file a to *.xls files
 
Jim wrote:
> what I need is to have the contents
> of filea.txt at the start of the .xls files.


Just for clarification: you want to prepend the content of filea.txt to
every *.xls file in a given directory.
Is this correct?

Your original question was anything but clear.

jue



Tad McClellan 04-28-2007 12:52 AM

Re: Cat file a to *.xls files
 
Jim <grace.jim@gmail.com> wrote:
> On Apr 26, 6:54 pm, Tad McClellan <t...@augustmail.com> wrote:
>> Jim <grace....@gmail.com> wrote:
>> > Hi I'm trying to get a perl script to work without much luck.

>>
>> > What I'm trying to do is to:

>>
>> > cat filea.txt to all .xls files in a directory

>>
>> > your help would be appreciated

>>
>> No Perl needed, just use the shell!
>>
>> # untested
>> for file in *.xls; do
>> cat filea.txt >>$file
>> done
>>
>> --
>> Tad McClellan SGML consulting
>> t...@augustmail.com Perl programming
>> Fort Worth, Texas



It is bad netiquette to quote signatures.


> Thanks Tad, it worked nicely but, what I need is to have the contents
> of filea.txt at the start of the .xls files. Is this possible to do?



# untested
for file in *.xls; do
cat filea.txt $file >tmp
mv tmp $file
done


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Michael Carman 04-28-2007 02:56 AM

Re: Cat file a to *.xls files
 
On 4/26/2007 5:54 PM, Tad McClellan wrote:
> Jim <grace.jim@gmail.com> wrote:
>>
>> What I'm trying to do is to:
>>
>> cat filea.txt to all .xls files in a directory

>
> No Perl needed, just use the shell!
>
> # untested
> for file in *.xls; do
> cat filea.txt >>$file


I think Tad has been hanging around Abigail too much lately.

-mjc

Tad McClellan 04-28-2007 04:57 AM

Re: Cat file a to *.xls files
 
Michael Carman <mjcarman@mchsi.com> wrote:
> On 4/26/2007 5:54 PM, Tad McClellan wrote:
>> Jim <grace.jim@gmail.com> wrote:
>>>
>>> What I'm trying to do is to:
>>>
>>> cat filea.txt to all .xls files in a directory

>>
>> No Perl needed, just use the shell!
>>
>> # untested
>> for file in *.xls; do
>> cat filea.txt >>$file

>
> I think Tad has been hanging around Abigail too much lately.



But when _I_ type of bunch of line noise, it never ends up
being a Perl program. :-(


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Jim 05-02-2007 01:24 PM

Re: Cat file a to *.xls files
 
On Apr 28, 12:57 am, Tad McClellan <t...@augustmail.com> wrote:
> Michael Carman <mjcar...@mchsi.com> wrote:
> > On 4/26/2007 5:54 PM, Tad McClellan wrote:
> >> Jim <grace....@gmail.com> wrote:

>
> >>> What I'm trying to do is to:

>
> >>> cat filea.txt to all .xls files in a directory

>
> >> No Perl needed, just use the shell!

>
> >> # untested
> >> for file in *.xls; do
> >> cat filea.txt >>$file

>
> > I think Tad has been hanging around Abigail too much lately.

>
> But when _I_ type of bunch of line noise, it never ends up
> being a Perl program. :-(
>
> --
> Tad McClellan SGML consulting
> t...@augustmail.com Perl programming
> Fort Worth, Texas


Thanks for your help. Works perfect!



All times are GMT. The time now is 01:38 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.