Sponsored Content
Top Forums Shell Programming and Scripting script to pull info from my email? Post 302305420 by xinix on Wednesday 8th of April 2009 11:19:44 PM
Old 04-09-2009
Thanks for some of the comments.
Quote:
Why are you reversing the output of ls and then getting the last line instead of just getting the first?
Basically it was the first working code I found online. Your suggestion is better.

Quote:
Why seven calls to awk instead of one?
Each one gets a unique piece of info that is used for a specific line in the echo command. If there's a single call to that can do it that would be nice. But I just started learning awk stuff a week ago so I'm using what I can get to work for me (even if it might be a bit barbaric).

Basically:
Code:
PLACE=$(awk '/Place                   :/ {print $3,$4,$5,$6,$7}' $NEWEST)

This command gets me the name of the place. I need to know this first because some of the important information is on a line that starts with that name.

Code:
DATE=$(awk "/^$PLACE/ "' {print $(NF-2)}' $NEWEST)

This line gets the mm/dd/yy date from the source file and another call gets the start hour.
This needs to be converted to a yyyymmdd format and time +5 hours, which is done by this:
Code:
DTSTART=$(date --date "$DATE $STIME +5 hours" +"%Y%m%d%H%M%S")

This is repeated to get the finish time.
I'm sure I could consolidate some of these commads. Maybe once I'm a little more experienced.

The "\n\" are not needed.

Quote:
How do you add an entry to your calendar?
The calendar uses a "filename.ics" file (basically an ical file) that several calendar apps seem to understand. This script adds the block of lines that make up an event entry just before the last line which closes the file.
the block looks something like this:

Code:
BEGIN:VEVENT
DTSTART:20090504170000
DTEND:20090504203000
DSTAMP:20090409021153
UID:34533016-Sync-Script
CLASS:PRIVATE
CREATED:20090409021153
DESCRIPTION:Descripion   
LAST-MODIFIED:20090409021153
LOCATION:Name of Place 
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Name of Person
TRANSP:OPAQUE
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:This is an event reminder
TRIGGER:-P0DT0H30M0S
END:VALARM
END:VEVENT

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email the changed info in the file

Hey Guyz Just need some help regarding this.I need to send an email(sendmail) to group of users, when ever the content in a file e.g abc.txt changes.We need to send the changed content in the email.We are using bash here.Thanks for your help Guyz --CoolKid (1 Reply)
Discussion started by: coolkid
1 Replies

2. UNIX for Dummies Questions & Answers

Pull a file from a remote server through a shell script

Hi, I am writing a shell script to pull a file from a remote server (Let say its a windows based remote server). One of my criteria is to pull a file only if it is not empty. We have done a similar script to push a file from our end to a remote server and before pushing it we check for the... (2 Replies)
Discussion started by: sashankkrk
2 Replies

3. Forum Support Area for Unregistered Users & Account Problems

Please list email ids or contact info of members

Hi , Is it possible to list the user's email id for further communication. Thanks, MoonwalaPL (3 Replies)
Discussion started by: moonwalapl
3 Replies

4. Shell Programming and Scripting

How to pull info under headers in file(awk,grep,while loop)

below is an extract from my file and I am trying to use Awk and grep and a while loop to pull infomation from under neath "HBA WWN=".HBA WWN=" reoccurs all over the file but the 100000c.....number are unique and I want to be able to pull and reference specifi information under this header ever time... (2 Replies)
Discussion started by: kieranfoley
2 Replies

5. Shell Programming and Scripting

Need script to pull multiple field from log file

I am hoping to get some help with a script to pull certain fields from a log file. User update (xx6xxx P) rpt (yy6yyy B) 2010/01/20 21:36:01.298 Remote client forward start streamid 85af 2010/01/20 21:36:01.307 rpt2 (ZZ6ZZZ G) rpt1 (YY6YYY B) urcall (CQCQCQ ) mycall (W1AW) user... (5 Replies)
Discussion started by: TedSD
5 Replies

6. Shell Programming and Scripting

Please do help: Perl Script to pull out rows from a CSV file

I have CSV file that contains data in the format as shown below: ABC, 67, 56, 67, 78, 89, 76, 55 PDR, 85, 83, 83, 72, 82, 89, 83 MPG, 86, 53, 54, 65, 23, 54, 75 .. .. .. .. I want to create a script that will pull out the rows from the above sheet and paste it into another CSV file.... (12 Replies)
Discussion started by: pankajusc
12 Replies

7. Shell Programming and Scripting

Script to pull hashes out of large text file

I am attempting to write a script that will pull out NTLM hashes from a text file that contains about 500,000 lines of data. Not all accounts contain hashes and I only need the ones that do contain hashes. Here is a sample of what the data looks like: There are thousands of other lines in... (6 Replies)
Discussion started by: chango77747
6 Replies

8. Shell Programming and Scripting

Bash Script to pull ipa server name on 500 servers

Hello All, I need help writing a bash script that will run on 500 LINUX servers and do the following: 1. Capture the ipa_server name from /etc/sssd/sssd.conf on a list of 500 servers in the ipahosts file. 2. Write to a file outputing only server name and IPA server name. Root ssh keys... (3 Replies)
Discussion started by: vtowntechy
3 Replies

9. Shell Programming and Scripting

Shell script to pull certain fields

I/m a beginner so be easy. I have text files that live on an AIX server. The files come in and I've been charged with writing a shell script to email out that pulls the first date, and the last date of the file. I need to load these 2 dates into 2 separate variables. I can figure out the variables,... (13 Replies)
Discussion started by: mattadams1983
13 Replies

10. Shell Programming and Scripting

Generic script to recursively cd into directories and git pull

Hi all, I'm trying to write a script to recursively cd into my Git projects and pull them, and will later expand it to build my projects as well. I'm having a bit of trouble with my current script, as I want to supply a command line argument to tell it which branch to check out. I can hard... (2 Replies)
Discussion started by: Cows
2 Replies
CALENDAR(1)						      General Commands Manual						       CALENDAR(1)

NAME
calendar - reminder service SYNOPSIS
calendar [ - ] DESCRIPTION
Calendar consults the file `calendar' in the current directory and prints out lines that contain today's or tomorrow's date anywhere in the line. Most reasonable month-day dates such as `Dec. 7,' `december 7,' `12/7,' etc., are recognized, but not `7 December' or `7/12'. If you give the month as ``*'' with a date, i.e. ``* 1'', that day in any month will do. On weekends `tomorrow' extends through Monday. When an argument is present, calendar does its job for every user who has a file `calendar' in his login directory and sends him any posi- tive results by mail(1). Normally this is done daily in the wee hours under control of cron(8). The file `calendar' is first run through the ``C'' preprocessor, /lib/cpp, to include any other calendar files specified with the usual ``#include'' syntax. Included calendars will usually be shared by all users, maintained and documented by the local administration. FILES
calendar /usr/libexec/calendar to figure out today's and tomorrow's dates /etc/passwd /tmp/cal* /lib/cpp, egrep, sed, mail as subprocesses SEE ALSO
at(1), cron(8), mail(1) BUGS
Calendar's extended idea of `tomorrow' doesn't account for holidays. 7th Edition October 21, 1996 CALENDAR(1)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy