Sponsored Content
Top Forums Shell Programming and Scripting Problem getting data to a report file. Post 12179 by Cameron on Thursday 20th of December 2001 04:39:17 PM
Old 12-20-2001
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 ...
Code:
  for xdffile in $1$2/df??
    do

      echo $xdffile
      # Aquire date of file being read.
      xdfdd=`echo $xdffile | cut -c31-32`
      xdfmm=`echo $xdffile | cut -c21-23`
      xdfyy=`echo $xdffile | cut -c24-27`
      xdfdate="$xdfdd/$xdfmm/$xdfyy"
  ##  echo "$xdfdate"

      # Aquire details of file being read.
      grep "/" $xdffile > $xdffile\.temp
      cat $xdffile\.temp
      while read discfile
        do

          xmnt=`echo "$discfile" | cut -f1 -d" "`
          xspc=`echo "$discfile" | cut -f6 -d" "`
          echo $xmnt $xspc

        done < $xdffile.temp
      rm $xdffile.temp

    done  ## End-of (for xdffile in $1$2/df??)

I can produce the following output to the console ...
Code:
/amadeus_stats/disc/Nov2001/df29
/          /dev/root              6000002   3243220   2756782    55%
/stand     /dev/boot                80000     27124     52876    34%
/u         /dev/u                12896000  10740718   2155282    84%
/u1        /dev/u1               20000000   9877234  10122766    50%
/u2        /dev/u2               31048858  12037908  19010950    39%
/x1        /dev/x1               26871358   6815596  20055762    26%
/x2        /dev/x2               26871358  14498316  12373042    54%
/x3        /dev/x3               26871358  23092756   3778602    86%
/ 55%
/stand 34%
/u 84%
/u1 50%
/u2 39%
/x1 26%
/x2 54%
/x3 86%
/amadeus_stats/disc/Nov2001/df30
/          /dev/root              6000002   3251368   2748634    55%
/stand     /dev/boot                80000     27124     52876    34%
/u         /dev/u                12896000  10764106   2131894    84%
/u1        /dev/u1               20000000   9878108  10121892    50%
/u2        /dev/u2               31048858  12039694  19009164    39%
/x1        /dev/x1               26871358   6854662  20016696    26%
/x2        /dev/x2               26871358  14686220  12185138    55%
/x3        /dev/x3               26871358  23243320   3628038    87%
/ 55%
/stand 34%
/u 84%
/u1 50%
/u2 39%
/x1 26%
/x2 55%
/x3 87%

My problem is that I'd like to send the percentages(%'s) to a report in the following manner.
Code:
-  Date     - / - /stand - /u  - /u1 - /u2 - /u3 - /x1 - /x2 - /x3 -
28/Nov/2001  54%    34%    75%   66%   45%   61%   55%   22%   80%

Any tips?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help !!!!Problem with data file

I have a 1 million record file and in there i have 580 bad records meaning like they were spread on to 2 lines and is making my process fail as it is expecting single line records. How can i correct this records spread into 2 lines into single line or how i can writer these records into a new... (34 Replies)
Discussion started by: dsravan
34 Replies

2. 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

3. Shell Programming and Scripting

Problem in writing the data to a file in one row

Hi All I am reading data from the database and writing to temporary file in the below format. 1=XP|external_component|com.adp.meetingalertemail.processing.MeetingAlertEmail|EMAILALERTPUSH|32|4#XP |classpath|/usr/home/dfusr/lib/xalan.jar: /usr/home/dfusr/lib/xerces.jar: ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

4. Shell Programming and Scripting

C Shell problem: using a key from one file to find data in another

I've never written scripts (just switched from Ada to C++). I have a book that's over my head and a few examples, other then that I'm floundering. Everything here at work is being done in C Shell. None of the C++ programmers are experienced in shell scripting. I have a data file with the... (2 Replies)
Discussion started by: bassmaster
2 Replies

5. Shell Programming and Scripting

Compare and print out data only appear in file 1 problem

Below is the data content of file_1 and file_2: file_1 >sample_1 FKGJGPOPOPOQA ASDADWEEWERE ASDAWEWQWRW ASDASDASDASDD file_2 >sample_1 DRTOWPFPOPOQA ASDADWEEASDF ASDADRTYWRW ASDASDASDASDD I got try the following perl script. Unfortunately, it can't give my desired output result... (7 Replies)
Discussion started by: patrick87
7 Replies

6. Shell Programming and Scripting

Scan and change file data content problem

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS (condition 1: After the last "X" per line, if the distance is less than or equal to 3 letter, replace those not "X" letter with "X") TREXXXXXXXSDFXXXXXDS (condition 2: Before the first "X" per line, if the distance is less than or equal to 3 letter,... (12 Replies)
Discussion started by: patrick87
12 Replies

7. Shell Programming and Scripting

Three Difference File Huge Data Comparison Problem.

I got three different file: Part of File 1 ARTPHDFGAA . . Part of File 2 ARTGHHYESA . . Part of File 3 ARTPOLYWEA . . (4 Replies)
Discussion started by: patrick87
4 Replies

8. 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

9. 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

10. 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
FDFORMAT(8)						       System Administration						       FDFORMAT(8)

NAME
fdformat - low-level format a floppy disk SYNOPSIS
fdformat [options] device DESCRIPTION
fdformat does a low-level format on a floppy disk. device is usually one of the following (for floppy devices the major = 2, and the minor is shown for informational purposes only): /dev/fd0d360 (minor = 4) /dev/fd0h1200 (minor = 8) /dev/fd0D360 (minor = 12) /dev/fd0H360 (minor = 12) /dev/fd0D720 (minor = 16) /dev/fd0H720 (minor = 16) /dev/fd0h360 (minor = 20) /dev/fd0h720 (minor = 24) /dev/fd0H1440 (minor = 28) /dev/fd1d360 (minor = 5) /dev/fd1h1200 (minor = 9) /dev/fd1D360 (minor = 13) /dev/fd1H360 (minor = 13) /dev/fd1D720 (minor = 17) /dev/fd1H720 (minor = 17) /dev/fd1h360 (minor = 21) /dev/fd1h720 (minor = 25) /dev/fd1H1440 (minor = 29) The generic floppy devices, /dev/fd0 and /dev/fd1, will fail to work with fdformat when a non-standard format is being used, or if the for- mat has not been autodetected earlier. In this case, use setfdprm(8) to load the disk parameters. OPTIONS
-n, --no-verify Skip the verification that is normally performed after the formatting. -V, --version Output version information and exit. -h, --help Display help and exit. SEE ALSO
fd(4), setfdprm(8), mkfs(8), emkfs(8) AUTHOR
Werner Almesberger (almesber@nessie.cs.id.ethz.ch) AVAILABILITY
The fdformat command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux July 2011 FDFORMAT(8)
All times are GMT -4. The time now is 03:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy