General :: Display AWK Output In Perl
Feb 8, 2011
I am trying to use awk command in perl. Below is my awk comamnd which works alone.
awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat
I would like to use this awk's output in shell script. I am using system command like below to get the out put. But it is not working.
$Output = system("awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat'");
View 3 Replies
ADVERTISEMENT
Sep 27, 2010
I'm writing a script that gives me some pertinent info about my servers, and the last little piece I need to figure out is the process list. There are going to be non-technical people looking at the output of the script and I'm trying to make it as simple as possible.
Right now, if I do ps -ef | grep <process> | grep -v grep
It obviously shows me the process, but the problem is that there is 4 lines of info in front of the process. ie
root PID date time java -1024 -cp oh,my,god,there,is,so,much,data,it,carries,on,for,4,lines,I,want,to,shoot,myself,trying,to,read,it,f inally,in,the,end,there,is,a,space /here/is/the/process
I'd like the output to be something like this:
PID: #### Process: /here/is/the/process
I've thought about how I could take the output and use awk or sed but I know there is probably an easier way to do it with perl.
View 12 Replies
View Related
Jul 27, 2010
I use 'grep -Ri "mypattern" .' to search for all files in the current directory recursively that contain "mypattern". But this command returns every single occurence, so that if a given file has several occurences of the pattern, the screen fills up pretty quick. More than likely, there's a way to restrict the output so that it only displays each file once, no matter how many occurences it contains, but I couldn't find how to do it.
View 2 Replies
View Related
Feb 4, 2011
Though I have little experience in the past, i just can't get to work what i have in mind.i want to display part of an output stream.
cat sample.xml
<packet or="recv" ljid="d.sample@test.local/" ts="20110204T15:02:55"><message from='j.sample2@test.local/' to='d.sample@test.local' type='chat' xml:lang='en' id='sd61'>
[code]...
View 4 Replies
View Related
Jun 16, 2011
Is it possible to get WGET to only show download progress e.g. download bar, opposed to all of the connection info, as it does look a little ugly on the client side, is this possible to do?
View 2 Replies
View Related
Oct 7, 2010
I have a file that contains "ls -la" output. I would like to display only the filenames, none of the other information before it such as permissions, ownership, size, and date.Would the cut command be the best way to hit this, or should I use Vim or sed?
View 6 Replies
View Related
Jul 29, 2010
My script is not diaplying output as it contains awk while iterating over the array. My script is as follows:
shortcodes=( "56882" "58585" "58888" "57575" "57677" );
for shortcode in ${shortcodes[@]}
do
echo "`awk -F"|" '/ShortCode=tel:$shortcode/ { arr[substr($2,1,4)]++ } END { for( no in arr) { print no , arr[no] } }'
[code]....
View 4 Replies
View Related
Apr 23, 2010
Consider a situation in which you want to display only specific lines of contents from a file or of a command's output. Yes, we have head and tail commands. But, how to view all the lines of a file except the last one or vise versa when we don't know the count of lines in advance?
Consider this output:
Code:
[root@localhost ~]# ps au | grep bash
root 6316 0.0 0.0 4672 1440 tty1 Ss+ Apr22 0:02 -bash
root 20847 0.2 0.0 4672 1432 pts/0 Ss Apr23 0:12 -bash
root 21167 0.0 0.0 3920 660 pts/0 S+ 01:00 0:00 grep bash
Here, I don't want the last line (in italic) to be included in the result since the last line is due to "grep bash" in the devised command "ps au | grep bash". Well, we can rewrite the devised command:
Quote:
"ps au | grep bash | head -n 2"
But, again, here we are specifying the count of lines to be included. But, in the presented problem we don't know any count in advance!
View 6 Replies
View Related
Feb 22, 2011
The video projector I have to use this week projects an image too large for its screen and spills over on every side.
Fixing the physical setup is not possible or at least unlikely for the moment: the only solution is to carefully resize and position windows so that they display in the visible part of the screen - using full-screen mode is out.
Is there a way around this via software, using xrandr for example?
# xrandr doesn't have a padding option...xrandr --output VGA1 --mode 1360x768 --left-of LVDS1 --padding 200
View 1 Replies
View Related
Jan 26, 2011
I have a perl script that prints an output to standard output using a for loop .It prints a new line every time ,I would like subsequent outputs to be displayed on the same line , I don't want a new line in standard output .Could anyone help plz
$count = $hrstorun*60/$intmin;
$interval = $intmin*60;
for ($c=0; $c < $count; $c++ )
[code]....
View 6 Replies
View Related
Feb 22, 2010
Here is some line I have written in perl to show my name :
[code]...
And after stdin kumar, its giving the output as
[code]...
output should be [code]... but why its coming in two lines?
View 2 Replies
View Related
Nov 25, 2010
I am trying to execute a Unix Command in perl and assigning its output to an array:
Code:
@File_List=exec("ls -1 /tmp");
but it is not working. I have tried the perl function system() also but its return code is
[code]...
View 10 Replies
View Related
Feb 18, 2010
The perl script I wrote works fine if I print the result to screen
x0_amber.pl 1 1000 0 5
But whenever I want to output to a file with
x0_amber.pl 1 1000 0 5 > x0_out
it never really prints out to the file.
It worked earlier, but I was playing with my PATH lately, I don't know if it's related to that
View 7 Replies
View Related
Jul 30, 2010
I have a large body of code (2000+ lines at this point) with lots of global variables, and a handful of locals. I would like to know is there a way to print out all global variables in use at a particular moment in time either from the debugger (ideally) or in line?
Basically I have something like this for the menu
1. Do thing 1
2. Do thing 2
3. Do thing 3
4. Do thing 1 and 2
5. Do thing 1 and 3
6. Do thing 1, 2 and 3
The problem is, as you select something from the menu again after you finish an option, the globals are still set and I'd like to clear them. If I had a list of all of them, it be easy to copy and paste and set them before the program ran another entry again. Suggestions? I'm aware of reset [a-z], but all of my vars are uppercase, and I would upset INC, and other upper case built-ins.
View 1 Replies
View Related
Jul 21, 2011
I want to store the return value of $DISPLAY into my perl script. I am new in perl script echo $DISPLAY
how could i make it?
#! /apps/perl/bin/perl
$session = `echo $DISPLAY`;
print "$session
";
but nothing come out
[Code]...
View 3 Replies
View Related
Sep 15, 2010
I've got a perl script which generates an html file. What I'd really like to do is send people to just one page (the perl page) which then generates the html and shows the html page in question. Thus the whole transition will be invisible to the user, they'll just have an html page.FYI the perl script generates a list of the users who last logged in to the system, it needs to be up to date (by the second).Let me know if this isn't clear, I understand it sounds a bit confusing...
View 4 Replies
View Related
Oct 4, 2010
Its my first post in here so please be patient I am trying to use regex in perl script to detect allowed words from the file and then print output to the screen.
As an example : I have text file with orders and returns :
Item2-SKU-2-11.08.2010-online
Item3-SKU-3-11.09.2010-return
Item4-SKU-4-11.09.2010-store
My question: is it possible to make sure that i am ony outputing to the screen orders based on few conditions like Item,order form e.g. online.And is it possible to have multiple matches (Item2 only diplay if ordered online etc)
View 1 Replies
View Related
Feb 8, 2010
i am having problem with displaying my text. my text file is displayed in such a way and is called test.......
Code:
Sam Worthington ... Jake SullyasZoe Saldana ... NeytiriasSigourney Weaver ... Dr. Grace AugustineasStephen Lang ... Colonel Miles QuaritchasJoel Moore ... Norm Spellman (as Joel David Moore)asGiovanni Ribisi ... Parker SelfridgeasMichelle Rodriguez ... Trudy ChaconasLaz Alonso ... Tsu'teyasWes Studi ... EytukanasCCH Pounder ... MoatasDileep Rao ... Dr. Max PatelasMatt Gerald ... Corporal Lyle WainfleetasSean Anthony Moran ... Private FikeasJason Whyte ... Cryo Vault Med TechasScott Lawrence ... Venture Star Crew Chiefmore
What i am trying to do is for the program to read "as" and then from there start a new line... thus the expected output is...
Code:
Sam Worthington ... Jake Sully
Zoe Saldana ... Neytiri
Sigourney Weaver ... Dr. Grace Augustine
[code]....
I keep getting the error saying ...
Code:
editmain.cpp.98:error: initializer fails to determine size of 'str'
what does this mean, and how can i be able to format my file in the way i want?
View 2 Replies
View Related
Jan 14, 2011
I am trying to run a java .class file by double-clicking it. So far my attempts at running it have been successful, but I don't' know how to keep the display open to see what the output is.
View 6 Replies
View Related
Jan 12, 2011
I have two computers both running Ubuntu 10.04. I use my laptop to ssh to the other computer. If I start for instance firefox via ssh from my laptop to have the browser showing up on the screen attached to the computer I ssh to? The computer i ssh to is better in handling graphics so I want to connect it to the TV and use my laptop as remote-control.
View 9 Replies
View Related
Feb 6, 2011
I am using a 64-bit Slackware 13.1 distro (I chose 64 by mistake, to be honest, as I know there's less trouble with a 32-bit distro) and I have some problems with my consoles (in text mode). After changing the runlevel in ininittab to graphic mode (4), I can't enter any of my consoles. Actually, only ctrl+alt F1 shows some output, regarding the graphic mode (I'm currently using KDE4, the default for slackware 13.1) and F6 is the only normal consoles I have access to. However, if I log out and log in (with another user, maybe) there's no output anywhere (not on F1, neither on F6).
View 1 Replies
View Related
Apr 26, 2010
I have an sony vaio laptop and the screen is pretty small so i have connect to tv with a HDMI cable but opensuse doesnt show on the tv. How do i output either the same screen or an extended desktop ?
View 5 Replies
View Related
Jan 24, 2010
I have a Dell Latitude D610, and am running a 2.6.21.7 kernel. If I close the screen on the laptop, the display output switches to the external VGA output. When I open the screen, the display output does NOT switch back. This occurs when running X and when in command line mode. Is there any way to get the output to automatically switch back when I open the screen?
View 2 Replies
View Related
Feb 3, 2010
I am beginner in ubuntu. I wish to run the programs that will display a picture which use the ffmpeg, sdl and lame. When I type gcc -o exercise exercise1.c 'sdl-config --cflags --libs' to compile the program it give this such of error :gcc: sdl-config --cflags --libs: No such file or directory. I have installed the gcc packages, SDL, FFMPEG, LAME but still cannot display the output. What should I do with the gcc packages?
View 1 Replies
View Related
Mar 28, 2011
I am running a scan via nmap (nmap -sP) and the out put looks similar to this:
Nmap scan report for x.y.z.com (10.x.x.x)
Nmap scan report for 10.x.x.x
If it can resolve the hostname it does, if not it just spits out the IP. I would like to know the best syntax to use with cut, or awk, so that the only output is either the IP or IP - HOSTNAME.
View 3 Replies
View Related
Dec 3, 2009
The display under vlc is strangely colored in blue, or red missing. Anyway the balance isn't correct. I tried every output module but no one is correct. I am running 11.2/kde.
View 9 Replies
View Related
Dec 17, 2010
I have a small problem with Perl and Apache.
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.
View 1 Replies
View Related
Aug 11, 2010
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?
View 7 Replies
View Related
Jul 7, 2010
I am trying to launch the perl config, but when I do so I can an weird error.It seems to be that it does not regonize perl ?
conf.pl: line 11: =: command not found
conf.pl: line 19: my: command not found
conf.pl: line 20: syntax error near unexpected token `{'
[code]...
View 2 Replies
View Related
Aug 14, 2010
I recently reinstalled the B module for perl. Now I found out it didn't just do that, it installed a whole new copy of perl into /usr/local/bin/perl. When I type 'which perl' at the terminal, it says '/usr/local/bin/perl' instead of '/usr/bin/perl'. Normally, this wouldn't bother me. But I installed the one in local/bin without threading support. The one that comes with the system already is build with threading support, which is why I want to switch back to the system perl, and possibly remove the one in /usr/local/bin.
So how do I change it so that the result of 'which perl' returns as '/usr/bin/perl'? And what do I have to do to remove /usr/local/bin/perl?
The reason I need threading support is because I'm designing a file copier that copies several chunks of a file simultaneously to speed up the copying process. Guaranteed a useful script if it works.
View 7 Replies
View Related