LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-27-2010, 10:14 AM   #16
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43

This is right if I remove "1" at the end of the line it will print only converted/counted values (Preliminary with E).
How to have all the rest part of input file ?

Last edited by czezz; 12-27-2010 at 10:15 AM.
 
Old 12-27-2010, 10:45 AM   #17
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Probably time you did a little bit of investigating yourself. Look here and you should be able to solve this.
 
Old 01-04-2011, 08:26 AM   #18
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43
I havent find right way to get rid of repeated Preliminary with E next to correctly counted value so I did a work around:

1. I have modified code I alrdy had to this below. This prints out each value correctly counted (with out repeated E value) but it sets each one value into a 1 columne.
Code:
nawk 'BEGIN {ORS=RS=",";}{printf "%.2f,\n", $0;}'
2. ...so the output from above need to be transpose.
On this post I got a nice way to do it: http://www.linuxquestions.org/questi...nspose-852796/
Code:
nawk '{printf "%s", $0}!(NR % 8){printf "\n"}'
Its work around but it works.
I got what I need
 
Old 01-04-2011, 09:13 AM   #19
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Well now that you have had a bit of a go ... see how this goes for you:
Code:
nawk 'BEGIN{ORS=RS=",";IGNORECASE=1}/E/{split($0,arr,"E");$0=sprintf("%.2f,",arr[1]*10^arr[2]/2^100)}RT' file
 
  


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 ssh from a shell script ? For ppl who can write shell scripts. thefountainhead100 Programming 14 10-22-2008 06:24 AM
Shell scripts consty Programming 2 02-18-2007 09:41 PM
Need help with shell scripts gudum35 Programming 11 02-23-2006 06:32 AM
I Need shell scripts flyyy_82 Linux - Security 1 01-27-2005 04:05 PM
Shell Scripts benwy Linux - Software 1 06-09-2003 02:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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