General :: Change The Value Of The Inputs In Sed While Looping?

Feb 21, 2011

how to change the value of the inputs in sed while looping

As such:

for i in `seq 1 10`; do
"do something funny, using OpenFOAM"
cd system
sed 's/oldvalue/oldValue+increment/' -i sampleDict
cd ..
done

So basically, can you for instance create a constant "a" and increase it for every loop interval and use it for sed?

View 2 Replies


ADVERTISEMENT

General :: Looping Through Csv File To Calculate Avg/min/max?

Sep 1, 2010

I have a csv file (id, loc, timestamp, impressions) that I need to derive some low-level calculations from. Im ok with basic sort and grep operations, but this one is challenging my feeble scripting skills (normally I�d throw it into a spreadsheet, but in this case Id like to ultimately create a script that I could automate). Ive already used cat/sort to order the csv file first on location and then timestamp so it looks like this:

Abt001, AA, 2009-01-01 10:51:00, 231
Cup002, AA, 2009-01-01 10:54:00, 3
Saf001, AB, 2009-01-01 10:51:00, 25

[code]....

What Id like to do is output to file a record of the total, min, and max number of impressions for each location. , e.g.

AA6504 3231
AB252525
AC37925109
ZZ35512341

how to do this and Im kind of stuck on how to approach it I think the combined steps of looping through the locations along with the min/max/sum calculations are throwing me. Eventually Id also like to do additional calculations like average, ect. but I think I can figure that out on my own if I can just get this part down.

View 10 Replies View Related

General :: Looping Through A Shell Script With Sql Statements?

Oct 7, 2009

I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting; Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below.

1. Copy file to be processed (one file at a time, from a list of 10 files in the folder ).

Code:

for i in *
do
cp $i /home/temp

2 . Create a snapshot(n) table : Initialize n = 1

Code:

create table test insert account_no, balance from records_all; -- creates my snapshot table and inserts records in SQL

3. Checking if the table has been created successfully:

Code:

select count(*) from snapshot1 -- query out the number of records in the table -- always fixed, say at 400000

Code:

if( select count(*) from snapshot(n) = 400000 )
echo " table creation successful.. proceed to the next step "
else
echo " problem creating table, exiting the script .. "

4. If table creation is successful,

Code:

echo " select max(value) from results_all " -- printing the max value to console

[code]....

View 7 Replies View Related

General :: Run Script From Another With Multiple User Inputs And Expect

Jun 5, 2011

I am literally bashing (pun intended) my head against the keyboard at this minute! I am trying to automate a script via cron for my centos server. The script requires two user inputs (e.g. read VAR). However, I do not want to edit the original file, as I would like to be able to run it normally as well. It is also made by someone else, and so if an update becomes available, it will be easier to install. My idea is that i create a cron script, to run this second script from, and the only way i could find was with expect. However I am having troubles, In order to test out expect, I have created the following:
test.sh

[Code]...

It looks as if the second input is completely ignored ?! what i am doing wrong? or if there is a more elegant solution to running a script from a script with user inputs?

View 2 Replies View Related

General :: Create BASH Script To Process Multiple Inputs On Read

May 26, 2010

First post from a very new Linux user....I am trying to create a BASH script that will allow user to provide multiple directory names, Checks if the directory exists and if not create the directory.

I am using the following code:

Which works fine as long as the user enters a single directory name. How can I modify this so it will process all directory names user enters on the read response?

View 5 Replies View Related

General :: How To Make BASH Script Yes / No User Input Query Terminate With 3 Invalid Inputs?

Mar 16, 2010

I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.

View 9 Replies View Related

Software :: Scp Is Looping Without Being In A Loop?

Jun 18, 2010

I'm trying to execute some fairly simple code to transfer some files from one server to another.

$ cat xfer_directory.sh
#!/bin/bash
cd /cygdrive/g/directory/usr

[code]....

View 1 Replies View Related

OpenSUSE Install :: Update Keeps Looping Back?

Apr 5, 2010

I've had openSUSE for a week. The update says that there are 10 updates. When I run it, first I get a flag saying that something can't be removed. Then when I run the rest of the up date, it loops back and starts over. I need a patch to fix the patch that fixes the patch that...etc.

View 8 Replies View Related

Ubuntu :: Computer Boot Looping Before Grub.

Mar 10, 2010

I have 9.10 installed, grub has loaded and worked, now all of a sudden nothing will boot.The HP screen comes up and then the computer reboot, constant reboot cycle. Can't even get into the BIOS. It will just sit there if I hit escape. Won't boot the live cd either. What can I do??? It has worked fine for the past month now.

View 6 Replies View Related

Ubuntu :: Bash Script Not Looping As Intended?

Nov 2, 2010

I've written a bash script to connect to each machine in our local network and update the fstab file to point certain NFS mounts to a new location.The script is meant to read in a list of shares and a list of workstations, rsync the relevant share then connect to each workstation and update the fstab file before moving onto the next share.In reality what is happening is it will perform the loop correctly for the first workstation in the list but will not move on to the next one. I'm really stumped on this and I'm sure it's something simple but I just can't seem to work out the answer!

Code:
#!/bin/bash
SHARES=$1

[code]....

View 6 Replies View Related

Ubuntu :: BASH Script Keeps Looping Infinitely?

May 27, 2011

I have a simple .bashrc backup script I've been working on, but my external hard drive needs to be plugged in for it to work. So I set up a while loop, that exits after the hard drive has been plugged in and backed up. Here it is:

Code:
#/bin/bash
pluggedin=1

[code]....

View 4 Replies View Related

Programming :: Looping Over Mysql Query Results In Bash?

Sep 15, 2010

I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.

DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'`
IFS=$'
'
for i in $DATA; do
echo "item = $i"

[Code]....

View 5 Replies View Related

Programming :: Looping Using While Read Line And A Variable Instead Of A File?

Sep 24, 2010

I created the following.

x="top
middle
bottom"

I would like to make the following work.

while read line
do
echo $line
done

instead of importing a file I would like to use the variable $x I tried using pipes, but with no luck. My goal is to read one line at a time, but not have to export my data to another file, I would like to keep it all within one script.

View 3 Replies View Related

Programming :: Looping Throghu Input Files With Different Number Of Days?

Nov 3, 2010

I want to itemize addition for each type of transactions. The example below is for 3 days,10/13/2010, 10/14/2010, & 10/15/2010.

PROD =89.25+89.25+104.47= 282.97
TAX =9.37+9.37+10.37 = 29.71
ETAX = 1+1+1 = 3

[code]...

View 8 Replies View Related

Ubuntu Installation :: Make Dell Spash Screen Stop Looping?

Oct 18, 2010

Why, after a successful (I thought) dual boot installation w/ a side-by-side lynx and meerkat install and XP does my system refuse to boot? It just gets to the Dell screen, giving boot options (none of which are making any difference) and keeps looping it. Last night, after re-installing the grub (lost after the XP install) everything was working fine. I powered down and this morning tried to restart and...this. I really don't want to have to reinstall everything and reconfigure and reinstall apps--what can I do? And more importantly, WTF did this happen to begin with?

View 1 Replies View Related

Programming :: VBA / Excel - Looping Through Image Controls Based On Cell Contents?

Jun 28, 2011

I have an Excel Spreadsheet which reports upon weekly performance. One portion of the worksheet looks at week over week increases /decreases. I've placed a number of image controls (15 in Total) next to cells which calculate week over week change. The image controls simply display an image depending on whether the value of the adjacent cell is positive or negative. So, here is my basic working IF statement:

Code:

Private Sub Worksheet_Change(ByVal UpDown As Range)
If Range("J26") > 0 And IsNumeric(Range("J26").Value) Then
Image1.Picture = LoadPicture("C:path oup_arrow.gif")
ElseIf Range("J26") < 0 And IsNumeric(Range("J26").Value) Then

[code]....

As you can see, this is pretty simple. What I'd like to do is find a way to loop through all 15 controls and avoid having 15 IF statements run on the Worksheet_Change() event. The cells containing the week over week values are all in the same column, but not continuous. Involved cells are: ("J26", "J27", "J33", "J34", "J35", "J36", "J37", "J38", "J39", "J40", "J42", "J43", "J44", "J45", "J46")

View 6 Replies View Related

Ubuntu Multimedia :: No Sound Inputs Available?

Jan 6, 2010

I can't seem to get my microphone working. I've gone into Sound preferences in Sound Recorder and there aren't any options for sound input, only the one sound output option "Internal Audio"

I'm using the Input and Output jacks on the motherboard.

Anyone know what I can do to get this working?

I've been using Ubuntu for a few weeks, I'm trying to switch.

View 5 Replies View Related

Ubuntu :: How To Delete GRUB Inputs

Nov 27, 2010

When i boot and GRUB loads there are too many options for ubuntu.There are like 7 different ububt options(i think it's for different kernels) and last the windows partition.Is it possible to get rid of some of the old kernel options

View 5 Replies View Related

Hardware :: Ps2 And Usb Ports Won't Recognize Inputs

Sep 19, 2010

He doesn't do anything except emails, Internet search and sort pictures and I don't think he or his wife do anything I haven't shown them. The computer is an older model but I'm unsure of the brand, the motherboard is Intel entry server S845WD1-E. Recently his mouse stopped working, then his keyboard. I am going to try a ps2 card (the ps2 is internal to board). We are unable to use a usb mouse or keyboard. I have installed a new usb card but that did not work. I've tried different memory but have not run memck on it with another computer. After trying several suggestion from various support sites, including Intel, I finally cleared CMOS, removing the battery and then reset jumpers. Now I can enter Setup, but of course can't use the keyboard to change the settings in BIOS. I want to load CD-ROM first, but can't access via keyboard to change. I suspect the motherboard is going out, but still have hope. This couple is elderly and fixed income so I'm trying to milk it for all I can. I can use his HD on my system just fine.

View 1 Replies View Related

General :: TV Tuner Software "no Signal" - Error: "MythTV Is Using All Inputs But There Are No Active Recordings"

Feb 6, 2010

I am using Ubuntu 9.10. I have downloaded MythTV frontend and attempted installing and using Hauppage USB WinTv -HVR 950Q tuner. On TVTime I get "no signal". I attempt configuring source but ge nowhere. I have used MythTv backend to set up tuner. It recognizes the tuner, but when I select "Watch TV" I get the message: "Error: MythTV is using all inputs but there are no active recordings?"

View 1 Replies View Related

Ubuntu Multimedia :: Getting Keyboard To Toggle Between KVM Switch Inputs?

Feb 14, 2010

I'm using an IOGEAR KVM Switch to switch between my newly built PC and Xbox 360. I've been using it for a while on my 360 with no problems, but to switch inputs you have to use a hotkey on a keyboard that is connected to the KVM switch (there is no button on the KVM switch to toggle between inputs). My KVM switch is compatible with Linux, but each time I plug in my Logitech Wired Wave keyboard into my KVM switch and use the hotkey it fails to switch the input. The hotkey is the Scroll Lock key on the keyboard, and the Logitech Wired Wave keyboard doesn't have a key dedicated to that function.

So I use the key combo for Scroll Lock, which is Fn + Pause/Break. I haven't mapped out all the keys on this keyboard yet, but I figured it should already be mapped out, since all the other basic keyboard keys are working. I managed to switch the toggle key from tapping the Scroll Lock key (combo) twice to tapping the Control key twice, after finally figuring out the manual's long and convoluted key combinations to change the input toggle key setting. If anyone else encounters this problem I would direct you to the Page 11 of the product manual, which is available at the product page linked to above.

View 1 Replies View Related

Ubuntu :: Keyboard Inputs Go To Tty7 And Tty1 At The Same Time

May 13, 2010

I installed Ubuntu with the netboot. I only installed the packages I needed. Concerning X, I installed xdm as login manager and fluxbox as window manager. All is working fine except that whatever I type under X (under xdm or, after logging in, under fluxbox) appears in tty1! The keyboard inputs appear under X and under tty1 (so usually after "login:", or hidden after "password:").

Let me provide you with more details. Starting from xdm, I cannot access to the other ttys. "ctrl+alt+F[1-6]" do not work. Actually, this is not entirely true: after I type "ctrl+alt+F2", all my keyboard inputs under X will be appear in tty2 (and not anymore in tty1). I can see that from /var/log/auth.log which has a lot of lines like this:

Quote:

May 13 10:15:45 data login[2182]: pam_unix(login:auth): check pass; user unknown
May 13 10:15:45 data login[2182]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=
May 13 10:15:48 data login[2182]: FAILED LOGIN (2) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure

These errors are due to the fact that tty1 receives a wrong login (something I typed under X, before pressing RET). BTW: If I connect to xdm using my password (instead of my passphrase, thanks to pam_ssh), then I login into tty1 at the same time.

I checked that X is running under tty7. "ck-list-sessions" returns:

Quote:

Session1:
(...)
x11-display = ':0'
x11-display-device = '/dev/tty7'
display-device = ''
remote-host-name = ''
is-local = TRUE
(...)

Under X, if I type "ctrl+alt+F7" and "RET", then X crashes and it is launched again. After this, all is working fine: the tty[1-6] can be accessed and the keyboard inputs do not go anymore to them when I am under X.

I face the same problem on two different computers (a desktop computer and a laptop). Notice that I face the problem even with pam_ssh not installed (I mentioned pam_ssh earlier).

View 1 Replies View Related

Ubuntu Multimedia :: Trying To Hook Up External Audio Inputs

Jan 5, 2011

i should start by saying i'm using ArtistX OS, (based on Ubuntu Karmic (9.10)) I have a cassette deck and a usb turntable that i want to use to digitize my old stuf. at first, there was no output from either device, but after much fiddelin', when i right click on the volume icon and hit sound preferences, input tab, i can see that there is now incoming signal from both devices, but no audio rendering. also, again after much try this or that, got audacity to record and playback (audibly, but i could still not hear it durring recording), but that which was rendered was not acceptable quality for archiving i havn't a clue what to try now

View 1 Replies View Related

Server :: Record Inputs Which Will Be Provided During Running Script?

Feb 22, 2010

Is this possible to record keyboard inputs in a file which will be provided during running a script.? Means suppose there is a script ./instal.sh To run this script, some inputs need to be provided.Is this possible to record these inputs in a file?

View 10 Replies View Related

OpenSUSE Multimedia :: DVD Player That Recognize Inputs From Remote Control?

Nov 14, 2010

Do you know any dvd playback app that can recognize inputs from a remote control (like play, pause e.t.c) and at the same time when I launch it to check the dvd rom and resume playback from last time. I used vlc but it does not seem that works like the way I do.

View 3 Replies View Related

Ubuntu :: 9.10 Stops Accepting Mouse Clicks And Keyboard Inputs

May 12, 2010

I am running Ubuntu 9.10 on an Acer Aspire 5920 laptop. For the most part it works well, but it seems to occasionally become mostly unresponsive (~1 / 2days). I say mostly unresponsive because I can still move the mouse, but I do not seem to be able to click on anything (either to open or close programs or windows, or interact with menus). The keyboard is also partially responsive. When I use my keyboard shortcut to get access to the Applications menu, the menu highlights and depresses as though it is opening, but nothing appears on the screen. I can eventually press Ctrl+Alt+Del to start the shutdown procedure (and the shutdown screen pops up with the 60s countdown).

But I cannot use either the keyboard or the mouse to select another option (Restart, Suspend, Hibernate, or even Cancel), nor can I select the Shutdown option to cause it to shutdown right away - I just have to wait the sixty seconds for everything to turn off. This seems to happen no matter what I am doing with no warning - browsing the web, playing a game, or working on a document. The only consistent thing is it only seems to happen when I have more than one program open and I am trying to switch between open windows.

View 2 Replies View Related

Ubuntu Installation :: 10.04 Loses Mouse / Keyboard Inputs At Random

May 28, 2010

I upgraded from 9.10 to 10.04 LTS last week (32 bit, gnome desktop, no desktop effects). The system was quite stable before the upgrade (it's usually on 24/7 with uptimes in the dozens of days), but ever since updating to 10.04, the system loses all mouse and keyboard input at random times.

I can still ssh into the system fine and reboot it in an orderly fashion from a laptop, but I'd rather that it wouldn't freeze like this in the first place

I've tried service gdm start / stop from an ssh session to see if it's an xorg-related problem, but sadly that did not help in recovering mouse / keyboard input.

I also tried unplugging and re-plugging the ps/2 keyboard and the usb mouse, but sadly that also didn't help.

I don't see any weird messages in dmesg, so it's not a kernel oops either it seems.

I'm using the proprietary nvidia driver if that matters.

View 6 Replies View Related

Ubuntu Multimedia :: Switch Pulseaudio Inputs And Outputs With One Click?

Sep 10, 2010

With pulseaudio handling sound on Lucid (10.04), when I plug in my USB headset it's recognized, but there was no easy way to have it be used without going to System > Preferences > Sound > Input & Output and checking the radio buttons. Then if it's unplugged, and plugged in again later, the setting has been lost, so it was back through the menus. Not good when the headset's not plugged in and I'm fumbling to answer a Skype call. What would be ideal is if pulseaudio could prioritize and always default to the headset when it's plugged in. But I'm told by one of the pulseaudio gods (Col) that it can't yet.Here's a way to at least get the switch down to one button on the panel bar.0. Get all your devices plugged in1. Find your outputs (speakers, headphones):Quote:pacmd list-sinks | grep alsa_output2. Find your inputs (such as a microphone):Quote:pacmd list-sources | grep alsa_input3. Write a bash file to choose one or both, like this but with device names appropriate to your system which you've discovered above for the alsa_output.* and alsa_input.* strings.Quote:

#! /bin/bash
pacmd set-default-sink alsa_output.usb-Generic_FREETALK_Everyman_0000000001-00-Everyman.analog-stereo
pacmd set-default-source alsa_input.usb-Generic_FREETALK_Everyman_0000000001-00-Everyman.analog-stereo

[code]....

View 7 Replies View Related

Ubuntu :: Audio Inputs And Jack-sense Cease To Working After A While?

Oct 19, 2010

both audio inputs (I use the integrated mic on my notebook) and jack-sense (integrated speakers/headphones) work properly, as they should. But after some time (from few minutes up to several hours) both of them cease to work simultaneously. After that the mic input levels turning gray and speakers don't work at all (when headphones were connected at that moment) or speakers don't mute when I connect my headphones (if headphones were not connected then). After I reboot, everything is okay again for some time, but then it happens again. Setting mixer levels manually with alsamixer doesn't help at all. I also tried different snd-hda-intel model settings in alsa.conf, but that just made things messed up, so I stayed with auto setting. This way everything (inputs/outputs/sense) works as should until it simply stops working.

It's maverick, ALC268, ATI Azalia (Intel HDA), alsa 1.0.23, but I had this problem with karmic and lucid as well when I tried them. Now I want to switch from Win7, but this is the only thing keeping me from it.

View 1 Replies View Related

Software :: Real Time Management Of Audio Inputs/outputs?

Jun 19, 2010

I was wondering if there is an application for Ubuntu (FOSS or otherwise) that would allow me real time management of all of my audio inputs and outputs. Essentially I have multiple microphones attached to my computer and multiple audio outputs. What I am looking to do is to be able to assign each different input to it's own audio output. A touch screen interface is a plus for the program but not necessary.

View 9 Replies View Related







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