Handling multiple commands inside FilterCommand in Seq File?
Moderators: chulett, rschirm, roy
Handling multiple commands inside FilterCommand in Seq File?
lets say i need to execute some commands in FilterCommand.
for eg:
tar cf mytar.tar A.txt B.txt C.txt
mv sample.html public_html
chmod go-rwx biglist
my question is:
should i write all these commands in a .txt file and give the path of this .txt file in Filter Command?
or some other solution?
Thnks
sunshine
for eg:
tar cf mytar.tar A.txt B.txt C.txt
mv sample.html public_html
chmod go-rwx biglist
my question is:
should i write all these commands in a .txt file and give the path of this .txt file in Filter Command?
or some other solution?
Thnks
sunshine
There's no text file support inside the Filter command, so you can't take that route. Multiple command support there is probably pretty limited. Dont' expect to be able to run multiple commands in a serial fashion there, but you may be able to pipe commands together.
Keep in mind how the Filter works. The contents of the Filename in the Sequential stage are 'redirected' into your command as Standard In and then Standard Out of your Filter command is read as input by the stage. So if you can get your command(s) working on the command line in a similar fashion, then you should be able to leverage those same commands in the Filter.
Probably still best to do all this who-ha 'before job' and create a new file that is read by the stage.
Keep in mind how the Filter works. The contents of the Filename in the Sequential stage are 'redirected' into your command as Standard In and then Standard Out of your Filter command is read as input by the stage. So if you can get your command(s) working on the command line in a similar fashion, then you should be able to leverage those same commands in the Filter.
Probably still best to do all this who-ha 'before job' and create a new file that is read by the stage.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
sill i haven't got solution.
assume that i need to execute multiple commands
eg:
cp a1 a2
cp a2 a3
cp a3 a4
these i need to execute before executing job.
if it is only one command,
just in can write in Before Subroutine .
but in this case,what i need to do?
Lookinf forward for ur reply
thanks
sunshine
assume that i need to execute multiple commands
eg:
cp a1 a2
cp a2 a3
cp a3 a4
these i need to execute before executing job.
if it is only one command,
just in can write in Before Subroutine .
but in this case,what i need to do?
Lookinf forward for ur reply
thanks
sunshine
Actually, you've gotten several solutions. Stop fixating on the 'Filter' ability of the Sequential file stage, it's not appropriate for any of the scenarios you've made up yet.
If you need to 'pre-process' a file or series of files to build something the Sequential File stage can read, then as previously noted do something 'before job'. That can literally be something done before the job runs or it can be something you do in a Before Job Subroutine.
1) Write a script to do the file manipulation:
1a) Execute the script using a Execute Command stage in a Sequence job before the Job Activity that runs your job.
1b) Execute the script using a custom routine and the Routine Activity stage in a Sequence job before the Job Activity that runs your job.
1c) Execute the script as a Before Job Subroutine using ExecSH.
2) String the commands together, separated by semi-colons:
2a) Execute the commands using a Execute Command stage in a Sequence job before the Job Activity that runs your job.
2b) Execute the commands using a custom routine and the Routine Activity stage in a Sequence job before the Job Activity that runs your job.
2c) Execute the commands as a Before Job Subroutine using ExecSH.
There's several solutions. Others can be crafted as well, but that should get you started.
If you need to 'pre-process' a file or series of files to build something the Sequential File stage can read, then as previously noted do something 'before job'. That can literally be something done before the job runs or it can be something you do in a Before Job Subroutine.
1) Write a script to do the file manipulation:
1a) Execute the script using a Execute Command stage in a Sequence job before the Job Activity that runs your job.
1b) Execute the script using a custom routine and the Routine Activity stage in a Sequence job before the Job Activity that runs your job.
1c) Execute the script as a Before Job Subroutine using ExecSH.
2) String the commands together, separated by semi-colons:
2a) Execute the commands using a Execute Command stage in a Sequence job before the Job Activity that runs your job.
2b) Execute the commands using a custom routine and the Routine Activity stage in a Sequence job before the Job Activity that runs your job.
2c) Execute the commands as a Before Job Subroutine using ExecSH.
There's several solutions. Others can be crafted as well, but that should get you started.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Here's a friendly piece of advice. You are ignoring what has been told to you. This is a bad habit, because you are ignorant of something and Craig has nicely tried to explain it to you twice. The filter command is supposed to return SCREEN OUTPUT as streaming rows to be redirected to the internal pipe setup by the stage instead of reading the physical file.
That being said, in unix you can execute several commands by separating them with a semi-colon ";".
However, now armed with this knowledge, you STILL CANNOT DO WHAT YOU HAVE ASKED with the filter feature.
That being said, in unix you can execute several commands by separating them with a semi-colon ";".
Code: Select all
tar cf mytar.tar A.txt B.txt C.txt ; mv sample.html public_html ;chmod go-rwx biglist
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
The filter needs a data stream (stdin) to work with. I'm not at DS session now to check, but it should work with "gunzip -" or, failing that, use an external command stage to perform the compression or decompression.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Make sure you have the full path to the file mentioned and that you've told gunzip to 'write on standard output'. Make sure it works from the command line and writes the uncompressed data to 'the screen' and then it will work in the Filter.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
The format of a zipped file is binary. Various algorithms including Lempel-Ziv-Welch are used that take advantage of the fact that different byte or group of byte combinations occur with varying frequencies within a file and that not all 256 possible values in a byte are used throughout the file (huffman encoding). This allows files to be compressed losslessly.
When reading or writing a compressed file I will use an external command stage and use the command "gunzip {filepath/name} -" or "uncompress {filepath/name} -" to read a compressed file and stream the data into the job.
When reading or writing a compressed file I will use an external command stage and use the command "gunzip {filepath/name} -" or "uncompress {filepath/name} -" to read a compressed file and stream the data into the job.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>