Posts Tagged Mass SMS

The power of a GNU-empowered terminal

My father needed some help. The task at hand was to send invitation SMSes to about 200 mobile phone numbers.

The mobile numbers were in a text file like an address book with several irrelevant fields. The mobile numbers were stored in the form of ‘Mobile:<number>\n’ . We wanted only the mobile numbers, so I did a

cat <phonebookfile> | grep Mobile

and there – all the phone numbers were separated. Next, I wanted to throw away the Mobile: part and retain only the number. That was done using awk:

cat <phonebookfile> | grep Mobile | awk “BEGIN{ FS = ‘:’ } { print $2 } > listofnumbers

Next, we wanted to send an SMS to each of these numbers. I typed the SMS into some file (call it smsfile) and then connected my mobile phone to the computer and then did a

for i in `cat listofnumbers`; do cat smsfile | gnokii –sendsms $i >> gnokii-out 2>> gnokii-error; echo $i >> finishednos; done;

And that’s it! We had some trouble inbetween, and sending failed starting from the Nth number in the file. So what we repeated the command with tail -n <num> instead of cat on listofnumbers, to send it to the remaining.

That’s the power of BASH + GNU on the command line.

1 comment December 15, 2007


Pages

a

Archives

Tags

aKademy asteroid magnitudes astronomy Astrophotography AWK BASH Bugfix camera camstream Carnatic Flute Carnatic Music Carnatic Vocal Commit D-Bus DBus Debian diffraction FOSS.IN GNOKII GNU grunt GSoC Hackathon IIT IITM IIT Madras KDE KDE.IN kstars Linux mail merge Mass SMS mcabber Parallel Port Philips ToUcam Photography PlanetKDE procmail Saarang segfault streamer SVN The GIMP Violin Webcam

Recent Comments

Aditya shanker raghu… on A summer at TIFR
Aditya shanker raghu… on About Me
Aditya shanker raghu… on A summer at TIFR
Wolf16 on About Me
Kelvin11 on About Me