Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?
I am looking for help in processing of those options: '-n' or '-p'
I understand what they do and how to use them.
But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.)
I did try it and -n works on 2 files.
Question is:
- is it possible to distinguish from which file is a printed line?
So, I use command like:
It have correctly selected lines, but I would like anyhow to get a file name where from each line is selected.
Not sure how to get it, if that is possible at all in such usage...
I understand the perl is using the
I am not sure what is going to be read by the '<>'
- does it already concatenated the input files in shell before starting the Perl?
- Or Perl do it inside somehow?
Maybe it opening each file as standard-input, redirecting the stdin to a current file?!
If so, is it possible to get its name?
Will appreciate help, if you get some idea about how it works with more than one file!
(I understand, I could write everything without the '-n' or '-p', but would like to have that shortage be used,... if possible)
Thanks.
Only one think I didn't get (acctualy unrelated to question, but) : what is the fl[0-9]?
Whas it assumed the same as next: fl{0..9} ?
So, it would generate list of files: fl1 fl2 .. fl19
They are a couple examples of ways you could call multiple files (even more than just two) at the command line, courtesy of the shell, without writing one by one.
fl[0-9] would expand to fl0 fl1 fl2 ... fl9 if they exist. fl1{0..9} would expand to fl10 fl11 fl12 fl13 ... fl19, and expects them to exist.
Yes, but: fl[0-9] (called "Pathname Expansion / Pattern Matching") expands to EXISTING files that match the pattern, fl{0..9} (called "Brace Expansion") yields all strings unconditionally:
Guess which of those exist in my PWD? Both methods do have their applications.
Also check the eof and eof() functions in the Perl documentation.
The eof function can be used to reset the line number in case multiple files are fed to the perl interpreter.
Hey,
Is there a way I can print " in a command line?
When I type "echo "set variable = disco"".... This actually prints echo set variable = disco but I would like to print it out as --- echo "set variable = disco"
Thanks,
Satya (4 Replies)
I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device.
My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
Hi Experts,
Would really appreciate if anyone can guide me how to compare two pdf files line by line and report the difference to another file. (3 Replies)
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Hi,
This evening i would like to download multiple pcap captures files in the wireshark wiki sites. My aim is to download the capture files .pcap .cap and etc on the wireshark site SampleCaptures - The Wireshark Wiki. i already used wget, lynx, htget but still their problem downloading..it seems... (1 Reply)
Hi,
I am creating a program with the C language that simulates the WC command in Unix. My program needs to count lines, bytes and words. I have not added the code to count bytes and words yet. I am having trouble understanding what the file option/flag '-' does. I can not visualize how it moves... (1 Reply)
could someone show me a sample command line option driven script?
i want to see an easy way to write one and how i can execute it using command line options such as typing in
read.pl -i <id> -c <cmds> -s <start> -e <end>
would read out all the commands run by ID . from start time to... (7 Replies)
I am trying to find a way to utilise the full potential of my cpu cores and memory on my windows machine.
Now, I am quite familiar with grep, however, running a Unix based OS is not an option right now.
Unfortunately, the 32 bit grep for windows that I am running, I cannot run multiple... (1 Reply)
Hi,
I have my code like this
v_site_eli=`sqlplus -s<<-EOsqlplus
$SQL_USERNAME/$SQL_PASSWD
WHENEVER SQLERROR EXIT SQL.SQLCODE
WHENEVER OSERROR EXIT FAILURE
SET TERM OFF
SET HEAD OFF
SET VERIFY OFF
SET FEEDBACK OFF
declare
VARIABLE vn_return_sts varchaR2(6);
begin
SELECT... (1 Reply)
I need a simple command line executable that allows me to join many wmv files into one output wmv file, preferrably in a simple way like this:
wmvjoin file1.wmv file2.wmv .... > outputfile.wmv
So what I want is the wmv-equivalent of mpgtx
I cannot find it on internet.
Thanks. (2 Replies)