Read files into variable using then pass to delete call


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read files into variable using then pass to delete call
# 1  
Old 02-11-2016
Read files into variable using then pass to delete call

I am trying read all the files from list into a variable line using bash. After there are read into the variable they are passed to a delete call. The files appear to be read line (as I can see them with the echo) by line into the variable, but the delete call is not removing them and I do not know why? Thank you Smilie.

list
Code:
overall.html
file1.bam
file2.bam
file1.vcf.gz
file2.vcf.gz

Bash
Code:
while read line; do
    echo $line
done < /home/cmccabe/list
wget --user=xxx --password=xxx --xxx --method=DELETE \
xxxx://www.xxxx.com/xxx/xx/xxxx/$line


Last edited by Don Cragun; 02-11-2016 at 05:40 PM.. Reason: fixed format
# 2  
Old 02-11-2016
Try:
Code:
while read line; do
    echo $line
wget --user=xxx --password=xxx --xxx --method=DELETE \
     xxxx://www.xxxx.com/xxx/xx/xxxx/$line

done < /home/cmccabe/list

This User Gave Thanks to jim mcnamara For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to read the output of a command line by line and pass it as a variable?

Hi, I have some 2000 names in a table like below. Java Oracle/SQL ANSI SQL SQL,DWH,DB DB&Java And by using for loop in my code i am able to get a single word but if there is any special character or space then it is considering as a next line. I have to execute the below queries in... (10 Replies)
Discussion started by: Samah
10 Replies

2. Shell Programming and Scripting

Read line of files and call store procedures

Hi, I wish to write a piece of code to read lines of the flat file and cut each lines of record to a variable, then use this variable to pass as an parameter of a Sybase stored procedures, if there are 5 lines of record from the text file, then this stored procedures will be called 5 times.... (8 Replies)
Discussion started by: newbie2011
8 Replies

3. Programming

C program to read n files and append it to a variable.

I am struck in the code of handling multiple files reading and appending it into a variable. My First file's entire content I have concatenated using strcat(<char pointer>,char array) In the Second file I extract using strtstr() function and below is the code. if( fp2 != NULL){ ... (2 Replies)
Discussion started by: gameboy87
2 Replies

4. Shell Programming and Scripting

Call java program from shell and pass values

Hi All, Can anybody please help me with how can i call my java program from shell and also pass parameter along with it so that the program can interpret the value/int and update the database. Thanks in advance Neha (1 Reply)
Discussion started by: Neha Goyal
1 Replies

5. Shell Programming and Scripting

need help with counting of files then pass number to variable

hi all, i'm trying to pass a count of files to a variable thru these set of codes: sh_count=$(ls -1 fnd_upload_LV*.* |wc -l) problem is if no files matches that, it will give an error "ls: fnd_upload_LV*.*: No such file or directory". how do i avoid having the shell script show that... (2 Replies)
Discussion started by: adshocker
2 Replies

6. Shell Programming and Scripting

Delete files older than 3 months.(read date from the name of the file)

Guys, My log files stored in the date format format below(log_20080714072942): TIMESTAMP=`date +%Y%m%d%H%M%S` LOG=/log/log_${TIMESTAMP}.log I'm looking for a shell script which deletes all files which is older than 3 months from today. Regards, Bhagat (3 Replies)
Discussion started by: bhagat.singh-j
3 Replies

7. Shell Programming and Scripting

how to read a value from a file and pass it to a variable

Hi, Some one please help me with this script. I have a file "sequence.txt" and contents of it look like below. 1 5 3 7 4 7 5 74 from my script i should be able to read every single and save the first columnbs to variable x1, x2, x3 and second column as y1, y2, y3 and so on. Then i can... (3 Replies)
Discussion started by: pragash_ms
3 Replies

8. Shell Programming and Scripting

Can we pass array with call by value in function

I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function (1 Reply)
Discussion started by: ranjithpr
1 Replies

9. UNIX and Linux Applications

read files from folder and then call another script

Hi, I am new to the Unix shell scripting world. It would be great if some body can help me with my requirement 1) Script (say script1.sh) which will take set of files from one folder (say input folder). 2) Take the first file from the folder and execute another script (script2.sh).Pass 2... (1 Reply)
Discussion started by: girishnn
1 Replies

10. Shell Programming and Scripting

read files from folder and then call another script

Hi, I am new to the Unix shell scripting world. It would be great if some body can help me with my requirement 1) Script (say script1.sh) which will take set of files from one folder (say input folder). 2) Take the first file from the folder and execute another script (script2.sh).Pass 2... (3 Replies)
Discussion started by: girishnn
3 Replies
Login or Register to Ask a Question