Solved

bash script to parse standard input from a text file

Posted on 2014-03-27
1
597 Views
1 Endorsement
Last Modified: 2015-03-19
Hi Experts,

I need to write a script (timetable.sh) that parses the contents of a text file and applies it to a 'curl' command using the following command.

cat units.txt | ./timetable.sh

Inside the units.txt file there are 3 lines of text which need to go into bold part of the curl command:

csi3207
csg5116
csi3208

curl -d "p_unit_cd=csg2305&p_ci_year=2014&cmdSubmit=Search" \ http://apps.wcms.ecu.edu.au/semester-timetable/lookup

How can I do this?  I can't seem to find a solution anywhere.

Or even another script that does the same would be extremely useful.

Thanks in advance
1
Comment
Question by:madstylex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 39958346
#!/bin/bash
while read id
do
   curl -d "p_unit_cd=$id&p_ci_year=2014&cmdSubmit=Search" http://apps.wcms.ecu.edu.au/semester-timetable/lookup
done

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question