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 11-03-2011, 06:26 AM   #1
rosemolr
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
ShellScript for processing data


Hi guys,
i'am a linux newbie and i have to automate one task.say i have one file which is having hex contents like

09 7C 6B 54 23 56 8D

my script should read the data from the file and it should display the values associated with the hex values like
if value is 09 it should print
"09: invalid param"
"7C : Yes"

Please help me up guys
 
Old 11-03-2011, 07:40 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
This sounds like a beginners exercise in the C programming language.
Try googling for a C primer using getc, fgetc, fopen, printf
 
Old 11-03-2011, 07:55 AM   #3
rosemolr
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for quick response

yup...like i said i'm a newbie..but if you guys can give me a spark on this..i can go ahead..please help me out
 
Old 11-03-2011, 08:10 AM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Second google hit searching 'getc printf fopen'
http://www.crasseux.com/books/ctutor...and-fgetc.html
 
Old 11-03-2011, 08:26 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
The subject is "ShellScript for processing data". Which shell will you be using? Can you convince us this is not homework? The LQ rules include "Do not expect LQ members to do your homework - you will learn much more by doing it yourself".

EDIT: what are "the values associated with the hex values" and what are the validity criteria? If the mapping is ASCII, 09 is not invalid -- it is a horizontal tab.

Last edited by catkin; 11-03-2011 at 08:30 AM.
 
Old 11-04-2011, 02:34 AM   #6
linuxwin2
Member
 
Registered: Oct 2011
Posts: 44

Rep: Reputation: Disabled
You can use script shell (bash).
You can use case;, in;, esac.

For example
Code:
#!/bin/bash

case $(var) in
    a) echo "aaaaaaaaaaaa";;
    b) echo "bbbbbbbbbbbb";;
    c) echo "ccccccccccc";;
    d) echo "dddd";;
     *) echo "other";;
esac
the hexa file have one line or more than one line?
 
  


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
[SOLVED] data processing mailbox-1691 Linux - Software 6 04-22-2011 11:45 AM
Pipelining data of find command in an array after processing the contents of the data AshishJogeshwar Linux - Software 5 06-10-2010 01:52 AM
Pipelining data of find command in an array after processing the contents of the data AshishJogeshwar Linux - Software 0 06-07-2010 06:15 AM
Processing data from a 'foreign' database with mysql, or tools to pre-process data. linker3000 Linux - Software 1 08-14-2007 08:36 PM
Data Processing joelhop Linux - General 8 01-01-2006 08:08 PM

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

All times are GMT -5. The time now is 02:08 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