Unix Technical Forum

Basic question about redirecting output

This is a discussion on Basic question about redirecting output within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi, all. I'm a DBA on an AIX 5.2 system. My main role is DBA, not AIX admin, so ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 08:27 AM
BD
 
Posts: n/a
Default Basic question about redirecting output

Hi, all.

I'm a DBA on an AIX 5.2 system.

My main role is DBA, not AIX admin, so I'm relegated to only learning
those bits of AIX which I need for my job. So if this seems like a
'basic' question, *sorry*. ;-)

My scenario is this: I have a directory with some files in it, and I
want to move only those files whose name contains a certain string (ie
'temp') into another directory.

I can get the list of these files with
ls | grep temp

So: can I not take the output of that command and insert it into a mv,
kind of like

ls | grep tmp | mv <newfolder> ??

....which would result in the files whose names contain the string
'temp' being moved to the new folder?

I'm sure I'll get it if I keep mucking about, but all I need is an
insight into redirecting output of shell commands.

Is there a quick syntactic pointer that someone can give me here?

Thanks!!

BD.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 08:27 AM
sol gongola
 
Posts: n/a
Default Re: Basic question about redirecting output

BD wrote:
> Hi, all.
>
> I'm a DBA on an AIX 5.2 system.
>
> My main role is DBA, not AIX admin, so I'm relegated to only learning
> those bits of AIX which I need for my job. So if this seems like a
> 'basic' question, *sorry*. ;-)
>
> My scenario is this: I have a directory with some files in it, and I
> want to move only those files whose name contains a certain string (ie
> 'temp') into another directory.
>
> I can get the list of these files with
> ls | grep temp
>
> So: can I not take the output of that command and insert it into a mv,
> kind of like
>
> ls | grep tmp | mv <newfolder> ??
>
> ...which would result in the files whose names contain the string
> 'temp' being moved to the new folder?
>
> I'm sure I'll get it if I keep mucking about, but all I need is an
> insight into redirecting output of shell commands.
>
> Is there a quick syntactic pointer that someone can give me here?
>
> Thanks!!
>
> BD.
>

It sounds like you only need:
mv *temp* <newfolder>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 08:27 AM
BD
 
Posts: n/a
Default Re: Basic question about redirecting output

>mv *temp* <newfolder>

Erf. Yes, that works. Thanks.

I knew it'd be way simpler than I feared. Oh well.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com