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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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. |
| |||
| 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> |