Ubuntu :: Bash Script For Each Line Of Input?

Jul 21, 2011

I've written my script so that it reads in the variables $1 $2 $3 $3....$12I have an input file as follows

word1 1 1 2 3 4 5
word2 1 1 2 3 4 5 6
word3 1 1 2 3 4

[code]...

View 9 Replies


ADVERTISEMENT

Ubuntu Multimedia :: Change The From Mic Input To Line Input?

May 1, 2010

I installed Lucid. I used to have Ubuntu 9.10 and to connect my iPod to my laptop's speakers. There was an option in 9.10 in the Sound Options to change the Mic Input into a Line Input. But now unfortunately I can't find it in Lucid have only 2 audio ports in the laptop: Headphone port, Mic port.

View 9 Replies View Related

General :: Scripting - Feed An Input File Into An If Statement Line-by-line

Dec 23, 2009

I am trying to write a script that takes an input file ($FileName) and an intermediate file ($FileName.info) and removes lines from $FileName if the value in $2 of $FileName.info is <75.

I can't figure out how to feed only one line of the .info file to the if statement at a time so that it will perceive it as an integer instead of a list.

The error I am getting now is ./script.sh: line 6: [: : integer expression expected

Sample input $FileName

Code:

Code:

Code:

Script so far:

Code:

View 10 Replies View Related

Programming :: Awk - Input From One Line - Execute Program - Input From Next Line - Execute Program

Sep 25, 2010

I have a file with two fields of numbers that I want to use as input for another program.

Code:

The above code does not work, as I think it would take the whole first and second fields as the input for one particular instance of the program 'inputbashangle'. What I want is to get the first two numbers from the first line of the file 'outfailtest', execute 'inputbashangle' with them, then move on to the first two numbers of the second line for all the lines of 'outfailtest'.

View 9 Replies View Related

Programming :: BASH: Each Line Of Multiple Text Files Gets Added To One Line?

Sep 12, 2010

I currently have 3 files with floating point data that I wish to have in a single file with the format:

Code:

F1 F1 F3 Output
a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3
a4 b4 c4 a4 b4 c4

View 3 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash: Read A Text File Line By Line?

Jul 7, 2011

bash 3.1.17(2) I'm trying do write a shell script which must operate on each line of an ASCII text file. So, all the code must be inside a loop, and inside the loop, the first thing should be to read the next line from the file. I have the bash read command. But it reads from stdin. Any way to make read from a file?

View 6 Replies View Related

Programming :: Bash Reading Multiple Files Line By Line?

Mar 8, 2011

I have a set of files containing data that I need to re-arrange into one single property list.

The files that I have look like this:

Code:
# cat uk
<string>10</string>
<string>11</string>
...
<string>29</string>

[Code]....

So the lines in the files match up but I haven't found a way of reading several files line by line.

View 3 Replies View Related

Programming :: BASH Sort List By End Of Line To X Position In Each Line?

Aug 18, 2010

I'm trying to make another file annotation script a little speedier than it has been by the up-until-now proven method of checking the last four characters in a filename before the "dot" (eg .jpg, .psd) against a list of known IPTC categories and Exiv2 command files. It occurred to me that if one script generated a list of files in directory foo, and the same or another script sorted that list by that four-letter tag,then that list could be used(instead of a for/do/done loop on the real files in the folder) by the command-file-matching script to "vomit out" which annotator file would go with file nastynewfile.jpg, f'r'instance. The script I had been using for this task looks like this:

Code:

while read 'line';
do
sp=$(echo $line)
vc=$(echo $sp | cut -d"," -f1)
cv=$(echo $sp | cut -d"," -f2)

[code]....

Where I seem to be stuck is with how to sort the lines in templist, which may be any number of different lengths, from back to front. sort -k looked promising, except it seems only to work the other way round. I thought of invoking a

Code:

q=$(expr length $line); echo $q
n=$[q-8]; echo $n

kind of thing, but that presented the problems of how to sort by those, how to tell sort where to find them (grep?) and how to "stitch them back in" to the original list, which is what I want to sort in the first place.

View 14 Replies View Related

Programming :: Bash Wait For One Line To Finish Before Going To The Next Line?

Jan 10, 2011

I have a wrapper script called MAIN.sh that runs several other script. It looks like this:

Code:
#! /bin/sh
script1.sh

[code]...

View 6 Replies View Related

Programming :: Line By Line Reading And Writing In Bash?

Nov 29, 2010

I have a text file (myfile.txt) with columns a,b,c.

123 2 23
124 2 24
125 2 22

[code]...

View 4 Replies View Related

Ubuntu :: Bash Script, Take User Input Then Use It As A Path?

Jan 29, 2011

I'm trying to make a script to make it quicker to encode videos.

Code:
#!/bin/bash
echo "Type the path of the video file"

[code]....

View 9 Replies View Related

Ubuntu Multimedia :: Switch From Audio Input From Mic To Line On 9.10?

Feb 28, 2010

I wanted to take an audio feed from a stereo amplifier into my HP Pavilion DV6 laptop, in order to digitally record some old vinyl.

In the Sound Preferences tab, I seemed to be able to record easily from the internal mic, but there seemed to be no easy way to switch the preferences to enable recording from the Line In socket on the laptop.

We tried muting the mic, this only caused the system to record nothing. We also tried all the various available options in "the Hardware Profiles" tab, "Settings for the available device", but no the laptop seemed to be getting no "line in" input with whatever profile we tried.

On Mac, it was as simple as switching the input sound preferences from "internal mic" to "line in".

View 4 Replies View Related

Ubuntu :: Dies (or Freezes) Too Often On Command Line Input?

Jan 31, 2011

It has been happening to me since I started to use this laptop from the company for a linux test bed. Several times a day, when I do something from the command line, for example running an application connecting to another host on the internet, etc,it comes to a freeze and does not come out of it. I can not do anything else than a forced reboot from the power button, because the keyboard and the mouse do not respond. This work laptop is a lenovo W500, running on ubuntu jaunty, release 9.04. I have not encountered this problem before with my personal laptop though. My person laptop is a lenovo X61s, running on ubuntu karmic, release 9.10Should I reinstall the work laptop with some other version of ubuntu? Could it be some hardware problem ? What tools should I use to diagnose

View 2 Replies View Related

General :: Can't Input Password In Command Line (ubuntu)?

Sep 19, 2010

When Linux ask for my password in command line,my keyboard becomes unresponsive just for that moment or let me put it this way,until i need to write my password my keyboard is unresponsive,but for all other things is fine.or for example,i can input my password when i have a graphic interface but i can't with command line or i can't login to my computer from command lineexcuse me if my question is doll,i moved from windows to ubuntu just lastweek,( & i am flying high in sky with ubuntu & digging a very deep hole for windows too!!.)

View 2 Replies View Related

General :: Capturing From Line One Input?

Apr 23, 2011

On my first card of ALSA (alsamixer -c 0) I would need to record the Line only.

View 1 Replies View Related

General :: [bash] Output Of One Script Is Input Of Another?

Mar 20, 2010

Now, I have one script called "defcon" defcon gets the current DEFCON level and outputs it using echo.

Code:

#!/bin/bash
DEFCON=`curl -s http://members.tripod.com/~Swat_25/defcon.html | sed -n '/^$/!{s/<[^>]*>//g;p;}' | sed '/^$/d' | grep '[12345]$'`
echo "The current DEFCON level is $DEFCON"

The second script ("tweet") updates my twitter account.

Code:

#!/bin/bash
curl -s -u USER:PASS -d status="$@" http://twitter.com/statuses/update.xml > /dev/null

What I want to do is be able to update my twitter account with the current defcon status (this is really more of a learning thing than something I actually want to be doing). The original script for tweet replaced $@ with $1, but if I use:

tweet `defcon`

it only uses the first word in the string, similarly if I used $2 or $3.So I changed it to $@. The normal function still works, but typing:

tweet `defcon`

updates twitter with nothing.

EDIT I should mention the /dev/null is there to catch the output of curl, otherwise it won't run silently. It still updates twitter normally with the send to /dev/null

View 1 Replies View Related

Fedora :: Can't Input Chinese In Bash And Sh,--(fc13)

Dec 29, 2010

i can input chinese in vim ,gvim,gedit ,and also zsh...., but i can't input chinese in bash and sh , i use ibus.

If i login with another account , i can input chinese in bash and sh !

i also diff the locale and env between the two account ,they are nearly the same;

example: when i input chinese ""i type "wq" and space,then bash print :

Display all 4063 possibilities? (y or n)

View 1 Replies View Related

Programming :: User Input Bash Script

Apr 28, 2010

I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?

Here's the script:

Code:

View 4 Replies View Related

General :: Bash: Input Password Into A Variable?

Aug 22, 2010

I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?

View 5 Replies View Related

General :: Bash: Auto Input Password?

Aug 28, 2010

When I use the scp command, here is a command prompt "Input password:",Now I want to use a one line command to perform the scp command.I tested the "echo "password" | scp xxx yu@10.xxx.xxx.xxx:/", but failed.

View 2 Replies View Related

Software :: Bash Input Control - Different Numbers ?

Mar 18, 2011

I'm making an bash script.

As input you can input different numbers from 1 to 3.

Depending from the input a text shows up.

View 2 Replies View Related

Programming :: Read Multiple Input With Bash?

May 7, 2010

As I'm starting to learn bash scripting I'm trying to automatize some tasks I usually perform. I have a notification mail I need to send several times a day. It has this structure:

Quote:

Dear user,
blah blah blah blah

You need to contact the following people:

[code]...

To replace "user", I found this:

Code:

read -p "Please enter username: " username
echo "Dear $username,"

Which probe to be very useful with other simple notifications like this. But I don't know how to manage the email addresses as they are usually more than one and could vary from 1 to 10. They should appear one above the other. I found this: "Here is a little work around. The only thing the user needs to do is hit enter without anything else on a line and it will close out"

Code:

#!/usr/bin/ksh
word=a
until [[ $word = "" ]];do

[code]....

I tried to use it and modify for my needs but I failed, I don't realize yet how can I use it. If possible, I would like to use the until loop like the above example just for learning purposes but any other form will be accepted as well.

View 10 Replies View Related

Programming :: Working With User Input In Bash

Jun 2, 2009

I've been using python/bash to help myself automate things for a long time, however I am curious. One reason I use python more is because I don't quite know how to work with user input in Bash, such as getting it to ask for input and wait, and then placing that user input into a command.

Here's an example of a script I use from time to time for converting OGG video files into AVI.

How could I write this same script in Bash? Keep in mind I am mostly self taught, so I am by no means an expert programmer.

Code:

View 3 Replies View Related

Programming :: Read Each Line Of A File As Input?

Jun 21, 2011

I'm writing a program which now accepts user input:

Code:
echo "Enter a date in the format YYYY MM DD hh mm ss."

read gregyr gregmo gregdy greghr gregmn gregsc This lets the user input a date and time, such as 2011 06 21 15 12 45, and have each number assigned to their corresponding variable. Later in the program, these variables are put into an equation, and then the terminal spits out the answer. Now I have to have the program read all of the lines from a text file, which is in this format, assign the variables.

View 7 Replies View Related

Red Hat / Fedora :: Change Input/Output Color In Bash?

Jun 5, 2009

When in the interactive envirment, my Input and Output are all mess-up. So i want to color the Input and Output with two different colors.. so i can figure them out..

View 1 Replies View Related

General :: Feeding Input To Interactive Programs In Bash?

Aug 30, 2010

If I have an interactive program, e.g top, which, after launch, can be fed with key strokes and changes its behavior, for example, after launching top and then pressing "1", you can see the CPU utilization per core. I was wondering if there is a programmatical way to do so, so I don't have to press "1" every time. I would think it is an easy task, but so far my attempts have failed.

View 4 Replies View Related

Software :: Bash : Input A Mp3 And Output The Lyrics As Text?

Dec 18, 2010

I am looking for a prgramme that output the lyrics when I give it an mp3...

Code:

fetchlyrics mymp3.mp3

based on its data inside of mp3

View 7 Replies View Related

Software :: Bash Script: Wait For Input From Kdialog Before Doing Sth?

May 27, 2011

The goal of the script is the following:Whenever I leave my house, my wife comes to my computer to check her mails (She has two computers of her own but they have a dangerous operating system, so they have been banned from the internet).She shuts down qbittorrent so as to download all her mails, and she forgets to execute it again on 98% of the times. End result: my computer is sometimes turned on for 10 hours doing absolutely nothing.I had therefore two choices: a) get on my wife's nerves until she gets the problem or b) write a bash script.If you are married, you will understand that bash scripts are easier to deal with than spouses.Ergo, I wrote the following script:

Code:
#!/bin/bash -x
while true ; do

[code]...

View 3 Replies View Related

Programming :: Bash: Handling Input From File And Keyboard?

Jan 20, 2009

I have this little shell script which copies file names taken from inputfile:

Code:
while read line; do
cp -i $line something

[code]...

View 4 Replies View Related







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