General :: Perl On Line To Take Out Select Values?
Jan 22, 2010
This is a Fix message - it is a type of protocol for transmitting financial dataeach number followed by a = sign is a tag - each tag means something. some tage are moe important than other.
At the moment I have a flat file which is being used by a few people. I want a script to remotely change the file, so I can start logging who is doing what.At this point here is one requirement I am trying to develop. We have text blocks who pretty much look like.I hope this is somewhat clear. I try to find $param for the right $workflow and change that. Can you help me to find $$var3 and change that?
Was wondering if any perl guru's could help me with a quick log file adjustment. I have a text file that looks like so (tabs and newlines are revealed so you can see what separates the data):
There are maybe 100 lines of text in this file at any given time. I need to delete all duplicate lines only looking at the first bit of text prior to the first tab. It doesn't matter which one gets deleted as long as there are no two lines that begin with that same text at the beginning before the first tab. So in this example, either the fist line "1234" or the last line "1234" would need to be deleted. I already have code in my script that opens the files - I just need the code to read the text into an array and the part that would find matches based on the above criteria, and make the deletions.
If it would be easier, I can even do a system call and use SED (v4.1.5) and/or AWK (3.1.5) instead.
I want to know the Perl command to replace a string by pointing the line number. I know how to replace a string without pointing a line number but I am in need to replace only the two matching string in a file
I just learn perl script.May i know how to simplify the code below especially in the red color part? i saw some examples in internet, they use "next" command.
I'm trying to get multiple numeric valued version information into a variable, all on the same line. I want for example $VERSION=3.1.0.01.002. I'm trying to pull seperate values from the file named version.properties, wherein the file contains;
I end up with the value of .002 ?? Seems like it's only getting the last portion because if I run the script thru "bash -x" I get: ... + VERSION=$'3 .1 .0 .01 .002 ' + echo $'3 .1 .0 .01 .002 ' .002
I was thinking as we have an option for invert selection , is there any option for invert deletion from command line. We can invert select and then pass the output to deletion, but i dont know how to invert select from the command line.
I want to select the fields which the 'top' command shows from the command-line. I can do that in the interactive mode when I press 'F', but I would love to do it via parameters (or with a configuration file, if it doesn't work otherwise).The fields I'd want to leave out are triggered by these letters: AHIOQTWMBackground:I installed the "compa" Gnome applet and want to always see what program currently uses up most ressources. For example, Pidgin sometimes starts using up 100% of 1 CPU and I have to kill it and start it again. I can already filter 1 or 2 programs from the 'top' command using the 'head' and 'tail' commands, but there are too many fields for my purposes by default. I could make a C program that filters those fields I need, but I think there must be a simpler solution.
I am trying to read a 5 1/4 in. floppy disk using an Intel D865 PERL motherboard, at 3 GHz. Bios was set to read this floppy. The system Lenny 2.6.31 i386 can't detect the 5.25 drive. Drive select seems not to be responding on the 5.25 drive. When connecting a 3 1/2 in. drive to the same motherboard connector (after changing the BIOS setting appropriately), r/w is ok under both linux and XP. I have tried three floppy 5.25 drives and different cables. All known to be ok on another box. I have tried XP and another linux, Etch. I have installed the latest available Bios upgrade from Intel. Upgraded from 0061 to 0089 bios versions. Is this a possible connector difference between 3.5 and 5.25 drives on the drive select line? The cable drive end connectors are different between the two drives.
I need user to input a password through command line in Windows cmd prompt. Is there a way to encrypt the input (such as put it into ......) when user is typing ?
If I use "#!/usr/bin/perl" in the beginning of a perl script the script won't work if the script is at all complicated. Simple scripts like "Hello World" works.
But if I use "#!/usr/bin/perl -w" in the beginning all scripts work?
If I don't use the -w this is whats in the logs:
(2)No such file or directory: exec of '/home/test.net/html/cgi-bin/uh/meny.pl' failed
Premature end of script headers: meny.pl
When I use the -w in the script the error-log shows me this.
meny.pl: Name "main::http_path_cgi" used only once: possible typo at /home/test.net/html/cgi-bin/uh/meny.pl line 24.
Code: # ps 22355 pts/3 00:00:00 bash # # ps -l 22355 F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 519 22355 22354 0 75 0 - 1338 wait4 pts/3 0:00 -bash # # ps -o pid,priority,command 22355 PID PRI COMMAND 22355 15 -bash #
Why are the priority values of the process different? What is the difference? Is the value 15 the "nice" priority? Then, what is the value 75? Please, explain the difference of each result.
I couldn't really decide where this should be posted, but this is the most general of the forums. Anyway, I've been playing a wargame on intruded.net in which some of the challenges require me to pass hexvalues into the programs as character values. All is well with this, and usually I would use the shell to pass it in, but most of these programs use the gets() method to get my input.
Here comes the problem... The other day I was using my desktop which runs slackware 64 13.1 to do these challenges. My method was to use "echo -e 'xefxbexadxde'" to print them to the shell's standard output and then highlight and copy the resulting values to paste to the program. This works just fine on slackware, but when I repeated the same processes on Ubuntu 64 10.04 (which runs on my laptop) the 'xde' always turns up to be 'x00'. Then I tried some other levels with similar responses, not all the hex values convert to the correct ASCII characters.
Is there any way i can pass two / three values to grep. Basically i want to list the lines in the file with three different values. Currently I'm using three grep to get my work done.
I need to set ulimit values according to I used Code: ulimit -c unlimited ulimit -s unlimited ulimit -u unlimited But after I log again to my session values are set to default. Now can I set this values so they don't change after log out of after reboot?
My cpu is set via Gnome-power manager to automatically speedstep under demand....
the thing is i have a few nice level 19 processes running most the time that eat up all the idle time, this forces my clock speed up and as such makes the fan noisy and uses more power...
basically what i would like to do is to ignore process load with a nice over a certian level when determining weather to speed step.
In my file there are 2 fields separated by space.Sample content of file are as follows:56060 154242 053030 0Now i want to check second field of the file and if all values in second field are 0(zero) and send mail containing all contents of the file
I am new here and want to lern CentOS. Current I have installed CentOS 5.5 x64 and Perl 5.8.8. Now i have install Perl 5.12.1 which located to /usr/local/bin/perl. But how I can move it to /usr/bin/perl so root based on Perl 5.12.1?