Data report


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Data report
# 1  
Old 06-24-2014
Data report

I have file with entries like below. I will be better in shell script

Code:
44
55
66
44
66
77

I want data like
Code:
44 is
-----------------
44
44
-----------------

55 is
----------------
55
----------------

66 is
----------------
66
66
-----------------
77 is
-----------------
77
-----------------


Last edited by bartus11; 06-24-2014 at 07:13 PM.. Reason: Please use [code][/code] tags.
# 2  
Old 06-24-2014
Why do some have extra newlines and some do not?

Why are some repeated twice and some are not?

Please explain the process by which your input is turned into your output.
# 3  
Old 06-24-2014
there is a file. I want the common numbers to come like below not just sorting out. Outout should come like below.


Code:
44 is 
----------------- 
44 44 
-----------------  
55 is 
---------------- 
55 
----------------  
66 is 
---------------- 
66 66 
----------------- 
77 is
 ----------------- 
77 
-----------------


Last edited by Corona688; 06-24-2014 at 07:29 PM..
# 4  
Old 06-24-2014
Code:
awk '{ A[$1]++ } END { for(X in A) { printf("%s is\n-----\n",X); for(N=1; N<=A[X]; N++) print X; print "-----\n" } }' inputfile

# 5  
Old 06-24-2014
OK, i am able do it.. However, can u also let me know how to append like below:

if 44 matches in another file it should be appended to other file like below only to matched section say 44 append 44 section.

Like earlier there are two 44's append to other 44 to 44 section to become three

44 44
44
# 6  
Old 06-25-2014
Quote:
Originally Posted by Anjan1
OK, i am able do it.. However, can u also let me know how to append like below:

if 44 matches in another file it should be appended to other file like below only to matched section say 44 append 44 section.

Like earlier there are two 44's append to other 44 to 44 section to become three

44 44
44
You are not at all clear about what you want here. The simple thing would seem to be to just add additional input files to Corona688's awk script:
Code:
awk '{ A[$1]++ } END { for(X in A) { printf("%s is\n-----\n",X); for(N=1; N<=A[X]; N++) print X; print "-----\n" } }' inputfile1 inputfile2 ...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Outputting data from log file to report

I have a log file that looks like this. the lines are grouped. 2 lines per entry. M: 2019-01-25 13:02:31.698 P25, received network transmission from KI4EKI to TG 10282 M: 2019-01-25 13:02:35.694 P25, network end of transmission, 4.3 seconds, 1% packet loss M: 2019-01-25 13:02:38.893 P25,... (7 Replies)
Discussion started by: ae4ml
7 Replies

2. Shell Programming and Scripting

Need help extracting data for report creation

Hi All, is there any way we can get the job names running with particular owner. Example: i want to get the job names running with owner as "autosys" (16 Replies)
Discussion started by: sdosanjh
16 Replies

3. Shell Programming and Scripting

Export data from database in Excel sheet with the help of Shell script and automated the report

Export data from database in Excel sheet with the help of Shell script and automated the report every day in the mornig. (1 Reply)
Discussion started by: neeraj617
1 Replies

4. Shell Programming and Scripting

Formatting Report and Reading data and fetching the details from contents file

Data I was trying to write shell script which will be return the output in the below format First i was trying to do these using sed. sed -n '/.ksh/p' mainksh.ksh sed -e 's/*\(.*\)/\1/g' mainksh.ksh $RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file. when i am... (0 Replies)
Discussion started by: rameshds
0 Replies

5. Shell Programming and Scripting

Create a report for client with a text data file

Hi, I am an amateur bash scriptwriter and I need to write a script which creates a report in a formatted, easy to read table-like that is displayed to standard output. The script has to export the followings: Process ID,User Name, Command Name,Priority..... Now I have a file that I can see all... (3 Replies)
Discussion started by: bashily
3 Replies

6. Shell Programming and Scripting

[Solved] Messaging data into required report

Hello to all; hope someone can assist me in getting the required output that my manager is expecting. I have been able to generate this code which does the comparison of the files and creates the file called diff_fuss_file.txt $ vi fussrpt.pl #!/usr/bin/perl #cd /tmp #rm output.txt ... (2 Replies)
Discussion started by: gvolpini
2 Replies

7. Shell Programming and Scripting

generate report based on data in files.

Hi All, I need to develop a shell script which does sanity check of a data file, as below. 1. For DATE columns, it should check if date is given in proper format or not? For example, if format of date is expected as DD-MON-YYYY HH24:MI:SS and we received the date in formation like DDMMYYYY HH24,... (1 Reply)
Discussion started by: ace_friends22
1 Replies

8. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

9. UNIX for Dummies Questions & Answers

create data file from report file

Dear Ones, kindly help me to create a data file from the report file as shown here under( i am new one to unix KNOW BASIC COMMANDS) file:rama.prt (ist record)(3 to 4 lines of text with different filed names) Name :M.LALITHA DOB:12/11/45 DESG :JA(P) STANO:300175 ... (3 Replies)
Discussion started by: cvvsnm
3 Replies

10. Shell Programming and Scripting

Problem getting data to a report file.

Hi all, I'm trying in vain to workout how I can generate a report from a months worth of files that get created every day. There is one file per day and each daily file contain the output from a df -v command. With the following section of code ... for xdffile in $1$2/df?? do ... (4 Replies)
Discussion started by: Cameron
4 Replies
Login or Register to Ask a Question