Curl - input line by line from text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Curl - input line by line from text file
# 1  
Old 08-21-2012
Curl - input line by line from text file

Hi,

I've got a text file with hundreds of lines I need to upload to an API via curl, one by one.

The text file is like:
Code:
2012-08-01 10:45,124
2012-08-02 10:45,132
2012-08-03 10:45,114

I want to get curl to go through the text file sending a post for each line.

like:
Code:
curl --request POST http://website/api/post?apikey=$key\&time=$timestamp\&json={meter1:$data}"

Any help appreciated!


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by zaxxon; 08-21-2012 at 09:59 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name data_file.txt column_name file_name col1 file1 col2 file2 col3 file1 col4 file1 col5 file2 now, i would like to... (4 Replies)
Discussion started by: tester111
4 Replies

2. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

3. Shell Programming and Scripting

Reading text file, comparing a value in a line, and placing only part of the line in a variable?

I need some help. I would like to read in a text file. Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01. Is this possible? any help is appreciated. (2 Replies)
Discussion started by: xChristopher
2 Replies

4. Programming

C++ Input File line by line

Hi there, I need to read some data from a file with string and number that is similar to this: word1 0.0 1.0 0.0 word3 word4 0.0 0.0 -1.0 word1 0.0 0.0 1.0 word5With this code: #include<iostream> #include<fstream> #include<string> using namespace std; int main() ... (5 Replies)
Discussion started by: Giordano Bruno
5 Replies

5. Shell Programming and Scripting

PERL or SHELL Scrript to search in Directories by taking line by line from a text file

Unix box server version *********** >uname -r B.11.00 >echo $SHELL /usr/bin/ksh --> in this server, I have the path like /IMbuild/dev/im0serv1 ---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
Discussion started by: pasam
9 Replies

6. Shell Programming and Scripting

Shell script to read a text file line by line & process it...

Hi , I am trying to write an shell, which reads a text file (from a location) having a list of numbers of strictly 5 digits only ex: 33144 Now my script will check : 1) that each entry is only 5 digits & numeric only, no alphabets, & its not empty. 2)then it executes a shell script called... (8 Replies)
Discussion started by: new_to_shell
8 Replies

7. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

8. Shell Programming and Scripting

sed to read line by line and input into another file

I have two files. Fileone contains text string one text string two text string three Filetwo contains Name: Address: Summary: Name: Address: Summary: Name: Address: Summary: I would like to use sed to read each line of file one and put it at the end of the summary line of file... (3 Replies)
Discussion started by: dolacap
3 Replies

9. Shell Programming and Scripting

How to input text on every 2nd line?

I have a file in two columns consisting of only numbers. I would like to put a string (the same textstring) on every second line, so that 501006 420.000 401602 165.000 . . . becomes: *Some_text 501006 420.000 *Some_text 401602 165.000 *Some_text . . . Are you up for it? (7 Replies)
Discussion started by: Medova
7 Replies

10. Shell Programming and Scripting

Formatting a text file to get data in exact line by line

I have my data something like this SERIAL FIRSTOCCURRENCE NETPROTOCOL 1947430693 07/01/2009 05:16:40 FR SERIAL FIRSTOCCURRENCE NETPROTOCOL 1947430746 07/01/2009 05:18:05 FR I want the output as follows.... (1 Reply)
Discussion started by: rdhanek
1 Replies
Login or Register to Ask a Question