Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Cannot run command line scripts in perl or gawk Post 302454741 by durden_tyler on Monday 20th of September 2010 01:29:48 AM
Old 09-20-2010
Quote:
Originally Posted by 10000springs
...

The message that I see follows:

"The system cannot find the file specified."

...
perl script - "perl -lne 'if ($.<=4) {push @x,$_} else {$x[($.-1)%4] .=" ".(split)[2]} END {print for @x}' inputfilename"
...
I was thinking that you put "f19" as your input file name, but that doesn't appear to be the case as can be deduced from your post above. "f19" was just a dummy file that I had created on my system to test the script.

Good that you mentioned you are on Windows. Quoting works differently on Windows than on *nix.

The Windows equivalent of my earlier post would be this -

Code:
C:\> type f19
C:\> perl -lne "if ($.<=4) {push @x,$_} else {$x[($.-1)%4] .= \" \".(split)[2]} END {print for @x}" f19

And you'd want to substitute f19 by your input file name.

Note that the main script is enclosed within double quotes, and the inner double quotes are escaped. I don't have Windows anywhere near me right now, so the commands are untested.

HTH,
tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what's the debug command for perl scripts

Hi, Can you please let me know if there's any debug command for perl scripts like set -x for shell scripts (2 Replies)
Discussion started by: dayanandra
2 Replies

2. UNIX for Dummies Questions & Answers

how to write perl substitute command in shell scripts

How to write perl substitute command in shell script without invoking a perl script file seperately. for ex: shell script to relace IT with CSC in a file using perl substitute command. (3 Replies)
Discussion started by: param_it
3 Replies

3. Shell Programming and Scripting

How can I make running gawk scripts more user-friendly in a Windows environment?

I know, and I apologise for using the W word, but I have users asking if they can use my gawk scripts, but I just know they're not going to like using the DOS command line. Is there any way for me to run my gawk scripts from a gui? Even if it's from a web page (html, php, what ever). I do not... (3 Replies)
Discussion started by: jonathanm
3 Replies

4. Shell Programming and Scripting

Is command line invocation of gnome-terminal to run more than one command possible?

Hello, I am trying to learn how to pass something more than a one-command startup for gnome-terminal. I will give an example of what I'm trying to do here: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ______________________________________________ ${0##*/} run... (0 Replies)
Discussion started by: Narnie
0 Replies

5. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

6. Shell Programming and Scripting

Run perl script, with command-line options

Hello everyone, I have a perl script which takes various command line options from user like : test.pl -i <input_file> -o <output_file> -d <value> -c <value> Now I have multiple input files in a directory: <input_file_1> <input_file_2> <input_file_3> <input_file_4> ..... .... ...... (6 Replies)
Discussion started by: ad23
6 Replies

7. UNIX for Dummies Questions & Answers

Run perl scripts to a distant server!!!!

Hello everybody; I want to run some scripts perl on my windows pc to a distant server linux which i connect to it via putty,I'm just a small beginner and I want just to know if this is possible or not and if you can send me some docs I will really grateful. (1 Reply)
Discussion started by: bassma
1 Replies

8. Shell Programming and Scripting

Running Two scripts in a single command line

Hi All, I have two scripts which i want to run in a single command line(or in a single script). And if both the scripts in the main script fail then i want to pass a value to a Application specific utility which will trigger some alert.The value can be anything. Somebody please help.It is... (1 Reply)
Discussion started by: shroh
1 Replies

9. Shell Programming and Scripting

Better way to run this perl command

i'm working with files that are huge in size. over 3GB. and i need to do a lot of pattern matching. I need a way to grep for what i want, using a tool that is available across most unix systems. i initially was gungho about grep, but not all capablities of grep are available on all OSes. so... (10 Replies)
Discussion started by: SkySmart
10 Replies

10. Shell Programming and Scripting

How to run 2 python scripts at the same time side by side on the same line?

Could I run 2 python scripts at the same time side by side output on the same line in this same format but with scripts? from itertools import izip_longest with open("file1") as textfile1, open("file2") as textfile2: for x, y in izip_longest(textfile1, textfile2, fillvalue=""): x =... (4 Replies)
Discussion started by: bigvito19
4 Replies
manipulate(3pm) 					User Contributed Perl Documentation					   manipulate(3pm)

NAME
OpaL::manipulate - Perl extension for manipulating files. SYNOPSIS
use OpaL::manipulate qw(functions); No functions or variables are exported automaticly so you have to specify them here. DESCRIPTION
OpaL::manipulate is a module for manipulating files. All functions are autoloaded so they will not be loaded into memory if you have not used them before. FUNCTIONS
perlmodifyadvanced It simply applies the script to the file to change its content. You also have to apply a message to tell what you are doing mostly for debugging and if any error occures. The error level tells how critical this action is to the script. USAGE: "perlmodifyadvanced"("file", "script", "message", errorlevel); The errorlevel is optional. perlmodify It simply fixes some stuff in the script string and then calls perlmodifyadvanced. USAGE: "perlmodify"("file", "script", "message", errorlevel); The errorlevel is optional. perlmodify_insertafter This function searches for something (regular expression). It if is found it inserts the text after it. But it will never insert the text twice. You also have to apply a message to tell what you are doing mostly for debugging and if any error occures. The error level tells how critical this action is to the script. USAGE: "perlmodify_insertafter"("file", "find", "text", "message", errorlevel); The errorlevel is optional. AUTHOR
Ola Lundqvist <ola@inguza.com> REQUIRES
OpaL::action, OpaL::read. SEE ALSO
OpaL::action OpaL::read perl(1) perl v5.10.1 2009-04-21 manipulate(3pm)
All times are GMT -4. The time now is 09:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy