General :: Unable To Display Output Using Awk In Array Iteration?

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


ADVERTISEMENT

General :: Breaking Iteration After A Given Number Of Iterations (bash)?

Jun 14, 2011

Take this block of pseudocode:

Code:
for i in $list; do
<some statements>
if i > 5
exit
<more statements>
done

That is, want to terminate the iteration just after 5 iterations. A first problem, is that list is a string and not a number. It's all I can say, except to keep reading bash monster manual.

View 8 Replies View Related

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 View Related

General :: Restrict Output To Display One File Each?

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

General :: How Display Part Of An Output Stream

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

General :: Windows - Getting WGET To Display A Less Verbose Output?

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

General :: Using Cut On File Full Of Ls -l Output To Display Only Filenames?

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

General :: Unable To Mount Array?

Dec 5, 2010

My first post and only my second day using Linux (Ubuntu 10.10), so please be gentle with me. lol. Bit of back ground to my problem. I have a Netgear Stora that has just died, but realy need the info off the drive inside. Support have told me that the drive can be read on Linux, so here I am. Right. Places-Computer shows drive as "array". System-Administrator-Disk utility gives me everything blank apart from State : not running, not enough componets to start. Now there is a button under this "Start Array". Can I simply just click this or is there more to it than that as I don't want to lose anything on the drive.

View 8 Replies View Related

General :: Display Specific Block Of Contents Or Lines In Output?

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

General :: Limit Video Output To A Section Of A Display And Leave The Rest Blank

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

Programming :: C Program To Get Input Of Array And Output It

Aug 14, 2010

I am creating a 15 integer array which is input from the user and outputted for the.

Ex.
Enter the array values: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Your values are: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Code:

View 4 Replies View Related

Programming :: Assigning Output Of A Command To An Array In Perl?

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

Programming :: Send A Mysql Query Output Into An Array?

Jul 27, 2010

i will be quick, im trying to send a mysql query output into an array ie:

Code:
declare -a HD
HD=`echo "USE db; SELECT uid FROM user" | mysql -u $login -p$pwd -h $dbhost -B`
echo ${#HD}
those vars in mysql connection are previously and correctly assigned.
but got an error

script.sh: 2: declare: not found

View 3 Replies View Related

General :: Unable To Access Intel Fake RAID 1 Array In Fedora 14 After Reboot

Jan 6, 2011

1st I am relatively new to linux (but not to *nix). I have 4 disks assembled in the following intel ahci bios fake raid arrays:

2x320GB RAID1 - used for operating systems md126
2x1TB RAID1 - used for data md125

I have used the raid of size 320GB to install my operating system and the second raid I didn't even select during the installation of Fedora 14. After successful partitioning and installation of Fedora, I tried to make the second array available, it was possible to make it visible in linux with mdadm --assembe --scan , after that I created one maximum size partition and 1 maximum size ext4 filesystem in it. Mounted, and used it. After restart - a few I/O errors during boot regarding md125 + inability to mount the filesystem on it and dropped into repair shell. I commented the filesystem in fstab and it booted. To my surprise, the array was marked as "auto read only":

[Code]...

and the partition in it was not available as device special file in /dev:

[Code]...

View 1 Replies View Related

Programming :: Nested Loop Using A Counter To Increment Array Output?

Feb 2, 2011

I work in a simulations environment. I'm trying to write a bash script that will read fields from a .csv file into an array, the first field being an identifiyng number and the second field being a corresponding url. There are about 1600 of these number/url combinations in the .csv file that i'm reading from. Once that is done i want it to parse a text file and match the number, when it has a match i want it to enter the corresponding url into a particular line in the text file. The script I have written (with the help of the people on this forum a while back) does this well, but now I have a lot more data to parse. I think the script itself is explanatory enough to see what i'm doing. What i would like to do is cut it down to one while loop nested inside another loop so that I don't have 1600 or so elif statements. I can't figure out how to increment the output of the array. for instance, the first cycle would find the number that matches ${record1[2]} and input the url stored in ${record1[3]}. the next cycle would match ${record1[4]} and input the url in ${record1[5]}, and so on, does that make sense? The code is below and a sample .csv and text file are attached.

[Code]...

View 14 Replies View Related

Programming :: Creating Array From Command Output (Bash Shell Script)

Jan 26, 2011

I have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct

So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/

Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.

View 5 Replies View Related

General :: Convert Full-disk RAID5 Array To Partition-based Array?

Dec 23, 2010

I have a RAID 5 array, md0, with three full-disk (non-partitioned) members, sdb, sdc, and sdd. My computer will hang during the AHCI BIOS if AHCI is enabled instead of IDE, if these drives are plugged in. I believe it may be because I'm using the whole disk, and the AHCI BIOS expects an MBR to be on the drive (I don't know why it would care).

Is there a way to convert the array to use members sdb1, sdc1 and sdd1, partitioned MBR with 0xFD RAID partitions?

View 1 Replies View Related

General :: Bash: Calculating In Array And Storing Result In Array?

Dec 2, 2010

I have an array called arrayini which stores numbers. I want to take log to the base 2 of each of the numbers in that array and put it in file called result. I've used the following code to do it.

Code:

size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
echo "scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >result

It works fine but its taking pretty long to calculate since I've got about 230,000 items in the array. So I decided to store the result into an array hoping that it'd be faster. I tried the following code. arrayresult is where I try and store the result. The code doesn't work because of the second last line.

Code:

unset arrayresult
size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
arrayresult[$i]="scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >FILE2

There is a syntax error clearly.

View 6 Replies View Related

General :: Unable To Adjust The Output

May 25, 2011

i m running a command

Code:

watch -n 1 -d netstat -i

to see the packet drops every 1 second. but the problem is the output is so long(Due to large number of virtual interfaces) it doesn't fit into the putty prompt. I dont need to monitor each and every network interface I m more interested in monitoring the interfaces starting from vif but whenever i run following command it doesnt display anything.

Code:

watch -n 3 -d netstat -i | grep vif*

What should i do?

View 7 Replies View Related

General :: Unable To Redirect Script Output To File

Aug 25, 2009

I have a python script that when run outputs to screen.

eg.
./international_sms_check.py 0403000511 919227434827
TS 21 check ok
TS 22 check ok
sms successfully delivered from 61403000511 to 919227434827
But when I try:./international_sms_check.py 0403000511 919227434827 > test

The file test is created but there is nothing in it.if I try ls > test this works fine with output of ls redirected to file test.

View 4 Replies View Related

Server :: Script Running Ssh Commands (via Loop) Exiting After First Iteration?

Oct 24, 2010

One of my servers needs to issue an "apt-get update" command on each of the clients in a lab. However, after the first update, it exits. In trying to replicate the problem with a simpler script, I created the following which fetches the listings of multiple directories from a client:

NUM=0
cat paths | while read DIR; do
ssh server-name ls $DIR > /tmp/$NUM.txt
NUM=`expr $NUM + 1`
done

Again, after the first iteration, the script exists. I tried the following line too, but it made no difference:

bash -c ssh server-name ls $DIR > /tmp/$NUM.txt

The only thing that worked so far is this

xterm -e ssh server-name ls $DIR > /tmp/$NUM.txt

View 3 Replies View Related

General :: Xset: Unable To Open Display

Oct 30, 2010

I tried to log on to a remote computer using ssh, but I got an error:

xset: unable to open display

View 4 Replies View Related

General :: Xwd: Unable To Open Display 'localhost:15.0'

Jul 5, 2011

I'm SSH'ed in to my Ubuntu 11.04 machine and trying to take a screen shot of a virtual display where I'm running (hopefully) Firefox. I get the error

Code:
selenium@selenium:~$ xwd -display localhost:15.0 -out ~/desk.xwd -root
xwd: unable to open display 'localhost:15.0'

I know that I have displayed the right display variable because in an earlier script that runs at system bootup I have

Code:
export DISPLAY=localhost:15.0
/usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 &

View 1 Replies View Related

General :: Unable To Get Video Display With Mint 9

Mar 6, 2011

Just loaded Linux mint 9 but having problems with video display. When I open Mozilla it works ok for awhile but then goes crazy and i can't see anything.

View 1 Replies View Related

Programming :: Output The Display In C++?

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

Fedora :: How To Keep Display Open To See What Output Is?

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

Ubuntu Servers :: How To Display Output On Ssh

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

Slackware :: Consoles Don't Display Any Output

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

General :: Video Display Size - Unable To View Many MP4 Videos

Apr 2, 2010

Since reinstalling Ubu9.04 from disk, I'm unable to view many MP4 videos.

My laptop only has 3 settings for res.

Here's some lshw:

And some attempt at adding a higher value in xorg.conf:

View 14 Replies View Related

OpenSUSE Hardware :: Output Display To Another Screen?

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







Copyrights 2005-15 www.BigResource.com, All rights reserved