Search Results

Search found 3730 results on 150 pages for 'bash'.

Page 27/150 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • BASH - How to retrieve rows from a file from #SOF to #EOF

    - by Charlie
    How to retrieve rows from a file from #SOF to #EOF in source.sh #SOF "Lorem ipsum dolor sit amet" "Vivamus pretium enim" "Est accumsan enim magnis" #EOF #SOF "Eleifend tincidunt id justo" "Tellus ut tincidunt vel ac a orci" "Sapien Nullam Sed nunc" "Vestibulum est accumsan enim" #EOF #SOF "Consequat mauris mollis montes" #EOF I need to get 3 files in target_1.sh "Lorem ipsum dolor sit amet" "Vivamus pretium enim" "Est accumsan enim magnis" in target_2.sh "Eleifend tincidunt id justo" "Tellus ut tincidunt vel ac a orci" "Sapien Nullam Sed nunc" "Vestibulum est accumsan enim" in target_3.sh "Consequat mauris mollis montes" Tell someone how to do it? thank you for your help

    Read the article

  • Bash Nested Loops, mixture of dates and numbers

    - by Saleh
    Hi, I am trying to output a range of commands with different dates and numbers associated. for each hour eg. Output im trying to do in a loop is: shell.sh filename<number e.g. between 1-24> <date e.g. 20100928> <number e.g. between 1-24> <id> So basically the the above will generate an output done 24 times for each particular day with a unique 4 digit id. I was thinking of having a nested loop, as the batch number needs to be unique. can anyone help?

    Read the article

  • Format stdin in bash

    - by User1
    I have a multi-line string coming from another program that I want to convert to a SQL command. I was hoping that printf could help me, but it doesn't seem to work: echo -e '1\n2\n3'|printf 'SELECT %s INTO MyTable' I was hoping to see: SELECT '1 2 3' INTO MyTable But I got: SELECT INTO MyTable How can I get the %s to read stdin?

    Read the article

  • Writing " to a file in bash.

    - by S1syphus
    Simply I need to write "echo" t${count} = "$"t${count}" To a text file, including all the So the output would be something like: echo " t1 = $t1" With " as they are. So I have tried: count=1 saveIFS="$IFS" IFS=$'\n' array=($(<TEST.txt)) IFS="$saveIFS" for i in "${array[@]}" do echo "echo" t${count} = "$"t${count}"" (( count++ )) done >> long1.txt And variations on this such as: echo "echo" """"" t${count} = "$"t${count}"" But I guess the wrapping in double " is only for variables. Ideas?

    Read the article

  • Extracting numeric value from output of a uder defined aggregate in netezza using bash script

    - by Ankit
    I am executing a shell script to execute my user defined aggregate which is taking inputs yavg=nzsql -c 'select avg(x) from Input1' which is giving output like this AVG ---------- 2.000000 (1 row) I want to pass only the numeric(double) value which is 2.0000(where xavg is expected) from this to S4(x,y,$xavg,$yavg) where x and y are the whole column from table Input1, xavg=nzsql -c 'select avg(y) from Input1' Below is my InputTable.txt which is a text file from which I am popluating my "Input1" table in the shell script. 1 2 3 2 1 2 3 2 1 nzsql -c 'create table Input1(x integer, y integer, v integer)' nzload -t Input1 -df InputTable.txt nzsql -c 'select * from Input1 yavg=`nzsql -c 'select avg(x) from Input1'` xavg=`nzsql -c 'select avg(y) from Input1' nzsql -c 'select S4(x,y,$xavg,$yavg) from test' Below is the output : xavg := AVG ---------- 2.000000 (1 row) yavg := AVG ---------- 1.666667 (1 row) and i am passing this value to S4(x,y,$xavg,$yavg) which is a User defined aggregate

    Read the article

  • Run command with space characters in bash script

    - by ??iu
    I have a file that contains a list of files: 02 of Clubs.eps 02 of Diamonds.eps 02 of Hearts.eps 02 of Spades.eps ... I am attempting to mass-convert these to png format in several sizes. The script I am using to do this is: while read -r line do for i in 80 35 200 do convert $(sed 's/ /\\ /g' <<< Cards/${line}) -size ${i}x${i} ../img/card/$(basename $(tr ' ' '_' <<< ${line} | tr '[A-Z]' '[a-z]') .eps)_${i}.png; done done < card_list.txt However, this doesn't work, apparently trying to split on each word, resulting in the following error output: convert: unable to open image `Cards/02\': No such file or directory @ error/blob.c/OpenBlob/2514. convert: no decode delegate for this image format `Cards/02\' @ error/constitute.c/ReadImage/532. convert: unable to open image `of\': No such file or directory @ error/blob.c/OpenBlob/2514. convert: no decode delegate for this image format `of\' @ error/constitute.c/ReadImage/532. convert: unable to open image `Clubs.eps': No such file or directory @ error/blob.c/OpenBlob/2514. If I change the convert to an echo the result looks right and if I copy a line and run it myself in the shell it works fine: convert Cards/02\ of\ Clubs.eps -size 80x80 ../img/card/02_of_clubs_80.png convert Cards/02\ of\ Clubs.eps -size 35x35 ../img/card/02_of_clubs_35.png convert Cards/02\ of\ Clubs.eps -size 200x200 ../img/card/02_of_clubs_200.png convert Cards/02\ of\ Diamonds.eps -size 80x80 ../img/card/02_of_diamonds_80.png convert Cards/02\ of\ Diamonds.eps -size 35x35 ../img/card/02_of_diamonds_35.png convert Cards/02\ of\ Diamonds.eps -size 200x200 ../img/card/02_of_diamonds_200.png convert Cards/02\ of\ Hearts.eps -size 80x80 ../img/card/02_of_hearts_80.png convert Cards/02\ of\ Hearts.eps -size 35x35 ../img/card/02_of_hearts_35.png convert Cards/02\ of\ Hearts.eps -size 200x200 ../img/card/02_of_hearts_200.png convert Cards/02\ of\ Spades.eps -size 80x80 ../img/card/02_of_spades_80.png UPDATE: Just adding quotes (see below) has the same result as the above, where I had been using sed to add backslashes convert '"'Cards/${line}'"' -size ${i}x${i} ../img/card/$(basename $(tr ' ' '_' <<< ${line} | tr '[A-Z]' '[a-z]') .eps)_${i}.png; I've tried both double and single quotes

    Read the article

  • [bash] checking wget's return value [if]

    - by wwrob
    I'm writing a script to download a bunch of files, and I want it to inform when a particular file doesn't exist. r=`wget -q www.someurl.com` if [ $r -ne 0 ] then echo "Not there" else echo "OK" fi But it gives the following error on execution: ./file: line 2: [: -ne: unary operator expected What's wrong?

    Read the article

  • Resolve bash variable containted in another variable

    - by kogut
    I have code like that: TEXT_TO_FILTER='I would like to replace this $var to proper value' var=variable All I want to get is: TEXT_AFTER_FILTERED="I'd like to replace this variable to proper value" So I did: TEXT_AFTER_FILTERED=`eval echo $TEXT_TO_FILTER` TEXT_AFTER_FILTERED=`eval echo $(eval echo $TEXT_TO_FILTER)` Or even more weirder things, but without any effects. I remember that someday I had similar problem and I did something like that: cat << EOF > tmp.sh echo $TEXT_TO_FILTER EOF chmod +x tmp.sh TEXT_AFTER_FILTERED=`. tmp.sh` But this solution seems to be to much complex. Have any of You heard about easier solution?

    Read the article

  • Replacing a column in CSV file with another in bash

    - by user2525881
    I have a csv file with a number of columns. I am trying to replace the second column with the second to last column from the same file. For example, if I have a file, sample.csv 1,2,3,4,5,6 a,b,c,d,e,f g,h,i,j,k,l I want to output: 1,5,3,4,5,6 a,e,c,d,e,f g,k,i,j,k,l Can anyone help me with this task? Also note that I will be discarding the last two columns afterwards with the cut function so I am open to separating the csv file to begin with so that I can replace the column in one csv file with another column from another csv file. Whichever is easier to implement. Thanks in advance for any help.

    Read the article

  • How to prevent filename expansion in for loop in bash

    - by cagri
    In a for loop like this, for i in `cat *.input`; do echo "$i" done if one of the input file contains entries like *a, it will, and give the filenames ending in 'a'. Is there a simple way of preventing this filename expansion? Because of use of multiple files, globbing (set -o noglob) is not a good option. I should also be able to filter the output of cat to escape special characters, but for i in `cat *.input | sed 's/*/\\*'` ... still causes *a to expand, while for i in `cat *.input | sed 's/*/\\\\*'` ... gives me \*a (including backslash). [ I guess this is a different question though ]

    Read the article

  • Escaping Problem in bash using isql

    - by latz
    Hi there, I am currently working on a little backup script from some firebird databases and I've come up with a weird escaping problem that I don't seem to be able to solve. Here's the thing in my script I create a variable called sqllog in which I would like to put the output of a chain of commands, here it is. sqllog=echo "SELECT * FROM RDB\$DATABASE;" | isql -u SYSDBA -pass mypasswd localhost:mydatabase | tail -n 2 | head -n 1 | wc -l if I try to execute this in shell I get the following error Statement failed, SQLCODE = -204 Dynamic SQL Error -SQL error code = -204 -Table unknown -RDB -At line 1, column 15. Table unknown RDB means it didn't take my try to escape the $. thx for any help :)

    Read the article

  • Good book for learning Bash shell?

    - by John Isaacks
    I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book?

    Read the article

  • Unexpected variable update when using bash's $(( )) operator for arithmetic

    - by philo
    I'm trying to trim a few lines from a file. I know exactly how many lines to remove (say, 2 from the top), but not how many total lines are in the file. So I tried this straightforward solution: $ wc -l $FILENAME 119559 my_filename.txt $ LINES=$(wc -l $FILENAME | awk '{print $1}') $ tail -n $(($LINES - 2)) $FILENAME > $OUTPUT_FILE The output is fine, but what happened to LINES?? $ wc -l $OUTPUT_FILE 119557 my_output_file.txt $ echo $LINES 107 Hoping someone can help me understand what's going on.

    Read the article

  • Source From Standard In (Bash on OSX)

    - by yar
    I am trying to do something like this ruby test.rb | source /dev/stdin where test.rb just prints out cd /. There are no errors, but it doesn't do anything either. If I use this: ruby test.rb > /eraseme; source /eraseme it works fine, but I want to avoid the intermediate file.

    Read the article

  • help with using alias in bash shell

    - by ajsie
    i want to have an alias "t" to enter a folder and list the content there. i tried with: alias t="cd $1; ls -la" but it just listed the folder i typed but did not enter it. i wonder why? cause when i use this one: alias b="cd ..; ls" it went back to the parent and listed the content. so i want the "t" do enter the folder i type in too. someone knows how to do this right?

    Read the article

  • bash "map" equivalent: run command on each file

    - by Claudiu
    I often have a command that processes one file, and I want to run it on every file in a directory. Is there any built-in way to do this? For example, say I have a program data which outputs an important number about a file: ./data foo 137 ./data bar 42 I want to run it on every file in the directory in some manner like this: map data `ls *` ls * | map data to yield output like this: foo: 137 bar: 42

    Read the article

  • ImageMagick bash script issue

    - by gAMBOOKa
    // This works convert ${path}${dst} -crop ${crop} ${path}${dst} // but when changed to this, it fails convert ${path}${src} -trim ${path}${dst} convert ${path}${dst} -crop ${crop} ${path}"pdf_"${dst} What am I doing wrong?

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >