d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Anybody Good With Unix Shell?
Add Reply New Topic New Poll
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 13 2015 12:01pm
I am having troubles doing this in my assignment.
Don't know if maybe I am being blocked out or something but any help would be appreciated.

Quote
Using the backquote and the date command, set time1 to be the current time in seconds and
set time2 to be the time in seconds of when you were born. Calcul
ate how many hours old you
are


What I got so far: :lol:

time1=`date +%s`
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Nov 13 2015 05:56pm
something something get the epoch date of your birthday + the epoch date of today, subtract, then convert that number back into a date

probably
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 13 2015 06:24pm
Quote (Eep @ Nov 13 2015 07:56pm)
something something get the epoch date of your birthday + the epoch date of today, subtract, then convert that number back into a date

probably


Do you know how to get epoch of a specific date?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 13 2015 07:11pm
Quote (ROM @ Nov 13 2015 07:24pm)
Do you know how to get epoch of a specific date?


he meant milliseconds, i assume.

http://unix.stackexchange.com/questions/156745/how-do-i-convert-a-date-to-milliseconds-since-unix-epoch-in-bash
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 13 2015 08:30pm
Quote (Eep @ Nov 13 2015 07:56pm)
something something get the epoch date of your birthday + the epoch date of today, subtract, then convert that number back into a date

probably


Thank you.
Quote (carteblanche @ Nov 13 2015 09:11pm)


Wasn't exactly what I needed but helped anyways because I saw something that help. :P

time2=`date -d "<my birthday>" +%s`
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 15 2015 02:03pm
Anybody know extended regular expressions?

I need to use VIM to search through a document with /\v

Quote
A line containing any of the character sequences: two, three, four,six or seven.

A sequence of 4 or more vowels (aeiou in upper or lower case) in a row.

A line containing between 15 and 21 characters. You need to match both the beginning and
end of the line in your pattern otherwise you will match lines that are longer than the
requirement


This post was edited by ROM on Nov 15 2015 02:04pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 15 2015 02:50pm
i dont really do much regex in vim, but this a starting place at least. i dont have any experience with look behinds and such; just basic regex

[aeiou]{4,}

^.{15,21}$
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 15 2015 02:53pm
Quote (carteblanche @ Nov 15 2015 04:50pm)
i dont really do much regex in vim, but this a starting place at least. i dont have any experience with look behinds and such; just basic regex

[aeiou]{4,}

^.{15,21}$


Thanks. Any help is appreciated. This kind of just popped up on an assignment and I've never seen it before. Was able to figure out some using google, but these ones got me.

This post was edited by ROM on Nov 15 2015 02:53pm
Member
Posts: 29,363
Joined: Mar 27 2008
Gold: 504.69
Nov 19 2015 05:25pm
How can I pipe the results of one egrep to another egrep?

Quote
One of Holmes’ enemies is the infamous femme fatale Irene Adler. Find all lines that contain the name “Adler” then run the output through egrep a 2nd time eliminating all lines that contain Irene.


Trying this with no luck.
Code
egrep -n 'Adler' Holmes.html | egrep '!Irene'

I can see there should be results but this is yielding nothing.

/edit

Never mind :)
Code
egrep -n 'Adler' Holmes.html | egrep -v 'Irene'


This post was edited by ROM on Nov 19 2015 05:40pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll