Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:14:36+00:00 2026-06-10T20:14:36+00:00

I’ve got half a C class and maybe one or two shell scripts I’ve

  • 0

I’ve got half a C class and maybe one or two shell scripts I’ve written to draw from as experience. I’m trying to parse data from a schedule in order to upload it to Google Calendar from a terminal. I receive the schedule in a block of text like this:

Sat Sep 01 2012 00:00:00 GMT-0700 (PDT) Saturday 2:00PM 11:00PM

Sun Sep 02 2012 00:00:00 GMT-0700 (PDT) Sunday 00:00AM 00:00AM

Mon Sep 03 2012 00:00:00 GMT-0700 (PDT) Monday 9:00AM 6:00PM

Tue Sep 04 2012 00:00:00 GMT-0700 (PDT) Tuesday 9:00AM 6:00PM

Wed Sep 05 2012 00:00:00 GMT-0700 (PDT) Wednesday 00:00AM 00:00AM

Thu Sep 06 2012 00:00:00 GMT-0700 (PDT) Thursday 8:00AM 4:00PM

Fri Sep 07 2012 00:00:00 GMT-0700 (PDT) Friday 10:00AM 7:00PM

And I’ve figured out that with googlecl I can type this into my terminal:

$ google calendar add "Sep 3 Work 9 to 6"

And I’ll get a calendar event I can then have automagically synced to my phone.

I’ve read through some of the documentation on sed and awk figuring I could just use these to grab say the 5th through 10th (ie Sep 01) characters of each line and the time the shifts start and end, add the "Work" title, and pipe this directly to googlecl. I haven’t gotten it down yet though.

I’ve also tried researching file i/o in C, as I could export my schedule as seen above to a text file and then maybe use C to pipe the schedule in plain-er English to Google Calendar.

Is sed and awk the preferred way of doing this? (I guess doing it with just common *nix commands is my first choice if I can figure it out) Should I instead write a little program in C to do this? Any help (even if it’s just linking me to your favorite tutorials on either so I can do some more reading) would be appreciated, as many of the pages I’ve found Googling were both very long and a little over my head. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:14:37+00:00Added an answer on June 10, 2026 at 8:14 pm
    awk '{ if ($9 != $10) {print "google calendar add \"" $2, $3, "Work", $9, "to", $10"\""}}' cal
    

    Result:

    google calendar add "Sep 01 Work 2:00PM to 11:00PM"
    google calendar add "Sep 03 Work 9:00AM to 6:00PM"
    google calendar add "Sep 04 Work 9:00AM to 6:00PM"
    google calendar add "Sep 06 Work 8:00AM to 4:00PM"
    google calendar add "Sep 07 Work 10:00AM to 7:00PM"
    

    Explanation:

    if ($9 != $10) {...}
    

    If they are the same it looks like you don’t need to enter them in your calendar. Also, implicitly checks for non-empty lines.

    print "google calendar add \"" $2, $3, "Work", $9, "to", $10"\""
    

    Print the string with relevant fields, escaping the quotes.

    edit: As for executing it automatically, there is quite some delicate quoting issues going on, so putting this line in a for-loop is not trivial (for me!). One easy way out is to store the results in “file”, and then “sh file”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.