Printing line in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Printing line in shell script
# 8  
Old 05-04-2015
Even nicer! And flexible ... I was close-minded on the 3.
# 9  
Old 05-04-2015
neutronscott

Need one more modification need date to be added . Like the below example . Appreciate your help so much

Code:
KCAR
05/01/2015 max 31
05/01/2015 min 62
05/01/2015 avg 36
05/02/2015 max 69
05/02/2015 min 41
05/02/2015 avg 75

# 10  
Old 05-04-2015
How about trying that one yourself?
# 11  
Old 05-04-2015
Code

Thanks RudiC for the advice . I am learning awk . It would be great if you can help me on this.
# 12  
Old 05-04-2015
I don't see any dates in your input file??? Where do these dates that you want to add to the output come from?
# 13  
Old 05-04-2015
Don Cragun forgot to mention. dates are not present.

Below data is 10 day data . example 1st day 31,62,36 which is max , min , avg then 2nd day max,min,avg. 3rd day max,min,avg as follows. So need to script it .

Code:
KCAR,31,62,36,69,41,75,46,78,55,70,44,69,41,65,40,63,41,61,42,64,43,66,41,65,44,66,44,68,46,69

# 14  
Old 05-04-2015
Quote:
Originally Posted by ajayram_arya
Don Cragun forgot to mention. dates are not present.

Below data is 10 day data . example 1st day 31,62,36 which is max , min , avg then 2nd day max,min,avg. 3rd day max,min,avg as follows. So need to script it .

Code:
KCAR,31,62,36,69,41,75,46,78,55,70,44,69,41,65,40,63,41,61,42,64,43,66,41,65,44,66,44,68,46,69

That isn't the question. What determines the start date? Are all days data sequential? (Are weekends and holidays included in the data? What do you consider to be a holiday? ...)

If your input file is showing accumulated data that starts on 2015-05-01, how was the writer of this file able to predict minimum, maximum, and average data for a week in the future?
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed , awk script for printing matched line before regular expression

hi All , I am having a large file with lots of modules as shown below ############################################### module KKK kksd kskks jsn;lsm jsnlsn; Ring jjsjsj kskmsm jjs endmodule module llll 1kksd11 k232skks j33sn;l55sm (6 Replies)
Discussion started by: kshitij
6 Replies

2. Shell Programming and Scripting

Help with printing new line in shell script

I'm having a script which outputs four different attributes A, B, C, D for a list of users. I want to insert expression such that once the output is generated for first user, output for next user should be printed in new line. Please help. (4 Replies)
Discussion started by: surdileep
4 Replies

3. Shell Programming and Scripting

Need help in Perl Script for printing next line

I got multiple of documents in which i have to extract a line coming after a ID..The scenario is Customer ID: none VT : 002/89 Customer ID: Yes VT: 001/89 Customer ID: none VT: 006/85 Customer ID: Yes VT: 003/56 I have to extract the id which is coming after YES..The output... (7 Replies)
Discussion started by: rajkrishna89
7 Replies

4. Shell Programming and Scripting

Need help with Korn Shell script for substring printing

Hi all, I am new to scripting. I have a file with colon separated values called mylist.txt cat mylist.txt 192.123.76.89:lmprod89 162.122.20.28:lmtstserver28 10.80.32.139:hewprod139 . . using our internal os utility (called mvsping) we need to check all these servers if they are... (6 Replies)
Discussion started by: kraljic
6 Replies

5. Shell Programming and Scripting

Printing from Shell Script

My print alias that works fine from the command line does not function from withn a shell script. Instead of actually performing the printing, it instead writes out the name of the file I'm trying to print. Does anyone know why? Much Thanks. (3 Replies)
Discussion started by: ttilsch
3 Replies

6. Shell Programming and Scripting

Printing the line number in bash script

Hi, I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened. Thanks, (6 Replies)
Discussion started by: suryaemlinux
6 Replies

7. Shell Programming and Scripting

shell script, why isn't if printing message?

Why isn't printing message? 1 #!/bin/sh 2 3 something(){ 4 echo "Inside something" 5 echo $1 $2 6 } 7 val=$(something "Hello " "world") But it prints. 1 #!/bin/sh 2 3 something(){ 4 echo "Inside something" 5 echo $1 $2 6 } 7... (4 Replies)
Discussion started by: cola
4 Replies

8. Shell Programming and Scripting

help needed in a shell script for printing files

Hi All, I am writing a shell script to print all the files in a particular folder. This script is on solaris server . I am using the lp command to send the requests . lp -d printername filename . The output I get is the request id. Is there any way I can use the request Id to determine if... (1 Reply)
Discussion started by: shahshilpa
1 Replies

9. Shell Programming and Scripting

Problem printing the property of xml file via shell script

Hi, I have a config.xml which cointains the tags like <CONFIG> <PROPERTY name="port" value="1111"/> <PROPERTY name="dbname" value="ABCDE"/> <PROPERTY name="connectstring" value="xyz/pwd"/> </CONFIG> This file is in some directory at UNix box. I need to write a... (4 Replies)
Discussion started by: neeto
4 Replies

10. Shell Programming and Scripting

printing last argument in shell script

All, I am having a shell script and i will pass different argument diferent time . Please tell me how can i find the last argument that i passsed each time when i exec the script. Thanks, Arun. (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
Login or Register to Ask a Question