LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2016, 08:38 AM   #1
LRob
LQ Newbie
 
Registered: Mar 2016
Posts: 5

Rep: Reputation: Disabled
Please help me solve this code!


echo "Hello World" | \
awk -F '' '{ for (i = NF; i > 0; --i) { printf("%s", $i) } }' | \
od -An -t uC | tr ' ' '\n' | sed '/^$/d'| \
awk 'BEGIN {
split("95:103:107:105:83:0:106:106:105:95:65:46", offset, ":")
i = 0
}
{
if ((i == 2) || (i == 8)) { print "." }
print $1 - offset[++i]
}' | \
sed 's/^32/ /' | tr -d '\n'
 
Old 03-14-2016, 09:45 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
please use [code]here comes your script[/code]
These are a lot of commands, an echo, awk, od, tr, sed, awk, sed and tr.
You can analyze it command by command, so start with echo - that is a simple Hello World, next comes the awk:
Code:
$ echo "Hello World" | \
> awk -F '' '{ for (i = NF; i > 0; --i) { printf("%s", $i) } }' 
dlroW olleH
Obviously this awk prints the same text - just in reverse order.
see man od, tr about their usage and flags
 
Old 03-14-2016, 10:01 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
As above, at least give it a go or be specific about which piece you do not understand.
 
Old 03-14-2016, 10:26 AM   #4
LRob
LQ Newbie
 
Registered: Mar 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
I was hoping someone would just figure out what the output of this section of code would be. I'm not proficient at all, just wanted to get the answer to this puzzle.
 
Old 03-14-2016, 10:43 AM   #5
Janus_Hyperion
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372

Rep: Reputation: Disabled
Quote:
Originally Posted by LRob View Post
I was hoping someone would just figure out what the output of this section of code would be. I'm not proficient at all, just wanted to get the answer to this puzzle.
If you run the code on the terminal, you would get the answer yourself. This would be an excellent opportunity to learn and become proficient ... No point in asking others to give you the answer.
 
Old 03-14-2016, 10:45 AM   #6
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
Quote:
Originally Posted by LRob View Post
I was hoping someone would just figure out what the output of this section of code would be. I'm not proficient at all, just wanted to get the answer to this puzzle.
That's not how the open source community works. People here are more than willing to help you solve your problems if only you don't sound like you're paying someone to do your job for you.
 
Old 03-14-2016, 10:51 AM   #7
LRob
LQ Newbie
 
Registered: Mar 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
I apparently didn't make myself clear. This is not an assignment, it's not my job, it's simply a fun puzzle that should give coordinates to where a cache is hidden!
I'm not planning on becoming proficient and I don't have a terminal to run the code myself so I thought I would come to this forum for someone to get the answer!
 
Old 03-14-2016, 10:55 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
the answer is: 55.764 52.367
 
1 members found this post helpful.
Old 03-14-2016, 10:58 AM   #9
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
Quote:
Originally Posted by LRob View Post
I apparently didn't make myself clear. This is not an assignment, it's not my job, it's simply a fun puzzle that should give coordinates to where a cache is hidden!
I'm not planning on becoming proficient and I don't have a terminal to run the code myself so I thought I would come to this forum for someone to get the answer!
No worries. But where's the fun when you're going to ask somebody else figure out? Lol
 
Old 03-14-2016, 11:00 AM   #10
LRob
LQ Newbie
 
Registered: Mar 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you Pan64. That looks to be where I was expecting the cache to be. I appreciate your time.
 
Old 03-14-2016, 12:07 PM   #11
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
Funny, I thought geocaching and the like was supposed to be about the thrill of finding the caches yourself. Apparently now you just get everyone else to do the work while you reap whatever
the prize / benefit might be ... I can see how this would be rewarding??
 
Old 03-14-2016, 12:30 PM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by LRob View Post
I apparently didn't make myself clear. This is not an assignment, it's not my job, it's simply a fun puzzle that should give coordinates to where a cache is hidden!
I'm not planning on becoming proficient and I don't have a terminal to run the code myself so I thought I would come to this forum for someone to get the answer!
No ... you made yourself VERY clear.

Suggestion is that you do not take on challenges in a form which require technology where you do not wish to learn or use it ever. Instead choose fun puzzles where you can solve them with your own resources. Why is it fun if you have absolutely no capability nor desire to attempt to solve it yourself? You apparently just want the end result. I'm sorry that someone decided to give you the result.

If you wish to continue using LQ, I'd suggestion reviewing http://www.linuxquestions.org/questi...#faq_lqwelcome

Last edited by rtmistler; 03-14-2016 at 12:32 PM.
 
Old 03-14-2016, 12:37 PM   #13
LRob
LQ Newbie
 
Registered: Mar 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Wow, just relax, grail and rtmistler Your making lots of assumptions, aren't you? You're way off in what you're thinking.
Oh, and you might want to check your blood pressure if something like this makes you so upset.
 
Old 03-14-2016, 12:48 PM   #14
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by LRob View Post
Wow, just relax, grail and rtmistler Your making lots of assumptions, aren't you? You're way off in what you're thinking.
Oh, and you might want to check your blood pressure if something like this makes you so upset.
Oh please don't think we're sitting at terminals turning red faced about your complete inability to do anything Linux. I do hope that if you have future questions, you'll ask them in a manner which the forum typically prefers. But for all that, I yield to whatever the collective accepts. If instant reaction to "Help Me!" posts are the rage, then so be it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to solve error in leach.err file while running leach code in ns-2.35? Kausha LinuxQuestions.org Member Intro 1 01-18-2016 03:07 AM
how to solve solve broken shell problem prasanth.george Red Hat 1 01-21-2011 09:48 AM
LXer: Compile source code - and solve problems LXer Syndicated Linux News 0 03-14-2009 07:11 PM
Please help me solve the problem of my PHP code naihe2010 Programming 10 03-07-2006 07:39 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration