LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-29-2005, 01:14 PM   #16
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,644

Rep: Reputation: 145Reputation: 145

A side question: The task could here be solved by replacing the 38th and 39th char with a ?. Can this be done with sed or another command? Reading in the sed oneliners I see only solutions for lines, for example print line 7 until 9, but not one for characters within a line, defined by their absolute position.
 
Old 11-29-2005, 01:56 PM   #17
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Is this what you're after?

Code:
awk '{sub(/^../,"??", $3); print}' timefile.txt

Cheers,
Tink
 
Old 12-06-2005, 03:39 PM   #18
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Hi All,

This is New thread. It's not related to previous one.

My Question is:

I have a table called "asproduced" table. In the asproduced table, I have two fileds like "VALID_LINES" and "numberofpaylines"

My table look like this

VALID_LINES numberofpaylines
1 3 5 7 9 9
1 5 10 15 15
1 2 3 3
1 1
1 5 10 15 20 20

My question is: I have to find the Max Number in the VALID_LINES FILED AND PUT IT INTO THE numberofpaylines field.
 
Old 12-06-2005, 03:52 PM   #19
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
It would be polite to let people know if any of the solutions posted were of any help.
Also, this is starting to look abit like homework.
 
Old 12-06-2005, 03:53 PM   #20
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Hi All,

This is New thread. It's not related to previous one.

My Question is:

I have a table called "asproduced" table. In the asproduced table, I have two fileds like "VALID_LINES" and "numberofpaylines"

My table look like this

VALID_LINES numberofpaylines
1 3 5 7 9 9
1 5 10 15 15
1 2 3 3
1 1
1 5 10 15 20 20

My question is: I have to find the Max Number in the VALID_LINES FILED AND PUT IT INTO THE numberofpaylines field.
Man ... you need to learn to think clearly before posting
a question... define what constitutes a valid line, and
what a payline might be. Is this going to be another back
and forth between the two of us for 5 posts each until you
finally tell us what you actually want?


Cheers,
Tink

Last edited by Tinkster; 12-06-2005 at 03:54 PM.
 
Old 12-06-2005, 04:01 PM   #21
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
I am sorry, It's not related to the sed command.


VALID_LINES numberofpaylines
1 3 5 7 9 9
1 5 10 15 15
1 2 3 3
1 1
1 5 10 15 20 20
 
Old 12-06-2005, 04:02 PM   #22
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Table is not look good

VALID_LINES = 1 3 5 7 9 noofpaylines should be = 9
VALID_LINES = 1 5 10 15 noofpaylines should be = 15
VALID_LINES = 1 2 3 noofpaylines should be = 3
 
Old 12-06-2005, 04:24 PM   #23
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Kalyani1;

You have posted a significant number of messages that have left us very confused.......
For one thing, you just posted something that you said was anew thread, but it was posted as a reply to the old one. To make a new thread, you have to click on the button that says...............NEW THREAD!!

Out of curiousity, several of us have suggested that you read some tutorials on utilities such as sed and awk. What have you read??
 
Old 12-06-2005, 06:19 PM   #24
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by Kalyani1
Table is not look good

VALID_LINES = 1 3 5 7 9 noofpaylines should be = 9
VALID_LINES = 1 5 10 15 noofpaylines should be = 15
VALID_LINES = 1 2 3 noofpaylines should be = 3
*sigh*

Now, in (whatever that was an example of, be it the table,
the desired output or some attempt to be descriptive) the
above, is noofpaylines supposed to be the last element on
the line, or the highest figure? And what is the purpose
of the
VALID_LINES =
?
 
Old 12-06-2005, 07:09 PM   #25
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
I have to find the Highest figure.

I am working one of the gaming comapny. we have a slot machines. Valid lines are betlines
 
Old 12-06-2005, 08:40 PM   #26
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Try to tackle it from there ...
Code:
awk '{for(i=2;i<=NF;i++){array[i]=$i};print array[asort(array)];delete array}' highest.txt
or
Code:
awk '{highest=0;for(i=2;i<=NF;i++){if($i>=highest)highest=$i};print highest}' highest.txt



Cheers,
Tink
 
Old 12-07-2005, 10:51 AM   #27
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Hi Tink,

Thank you so much. It's almost working fine, but in the valid_lines filed first line is not taking
For eg: VALID_LINES=1
VALID_LINES=1 3 5 7 9
VALID_LINES=1 2 3 4 5

I changed i=1 instead of i=2
 
Old 12-07-2005, 11:23 AM   #28
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You mean "first column"? Anyway, glad I got you started ;}
and you REALLY should learn the ropes, mate. Or have somebody
else with some programming knowledge at your workplace do
these things.


Cheers,
Tink
 
Old 12-07-2005, 11:48 AM   #29
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by pixellany
Kalyani1;

Out of curiousity, several of us have suggested that you read some tutorials on utilities such as sed and awk. What have you read??
Glad to hear you are making progress---how about the answer to my question?
 
  


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
sed command rharris72 Programming 6 11-20-2005 08:26 PM
sed command pazvant Linux - Software 2 05-09-2004 12:58 PM
sed command linuxdev Linux - Newbie 9 02-24-2004 04:50 PM
sed Command linuxdev Linux - Newbie 3 02-09-2004 11:27 AM
sed command kwigibo Linux - General 3 04-21-2002 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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