Sponsored Content
Full Discussion: Change file format
Top Forums Shell Programming and Scripting Change file format Post 302172711 by sapics on Tuesday 4th of March 2008 02:44:03 PM
Old 03-04-2008
Change file format

Hi I have a file in the following format
I have to convert this into four files , in the format as below.

Data under Process SFA SUccess Section gets into file Named SFA_SUCCESS inthe following format
ctr1,120
ctr2,1785


Data under Process SFA FAil gets into file Named SFA_Fail inthe following format
Ctr1,40
ctr2,624
So on...

Now the number of ctr1 under each section can change,
so we have to grab everyting under one section & place in the file, without the operators,




Statistics Report - 2008/02/07
---------------------------------------------------
process SFA Success
ctr1 <= 120
ctr2 <= 1785
ctr3 <= 2616
ctr4 <= 50958
ctr5 <= 9148
ctr6 <= 3718992
ctr7 <= 1567
ctr8 <= 203
ctr9 <= 455
ctr10 <= 199460
process SFA Fail
ctr1 <= 40
ctr2 <= 624
ctr3 <= 74
ctr4 <= 11
ctr5 <= 2
ctr6 <= 1732
ctr7 <= 21747
Process MTA Success
ctr1 => 63780
ctr2 => 63669
ctr3 => 135
ctr4 => 1674
ctr5 => 8274
ctr5 => 1772

Process MTA Fail
ctr1 => 5
ctr2 => 14
ctr3 => 10
ctr4 => 5096
ctr5 => 810
ctr6 => 1847



Any Ideas, Suggestions,

Thanks.

Anu,
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Change format to file II

hi all... i have a big problem, and i hope someone can help me... i have a flat file, and its columns are separated by comma (CSV), something like this: 78 , 204R180 , 90/100 , 200001 , 12 ,200002 ,13 ..... 78 , 204R180 , 90/100 , 200001 , 29 ,200002 ,30 ..... 78 , 204R180 , 90/100 ,... (0 Replies)
Discussion started by: DebianJ
0 Replies

2. Shell Programming and Scripting

To Change the file format Pls Help!!!

Hi All, I have a file like john::208:johnson john::208:mery john::208:test admin:*:1:johnson admin:*:1:test and wanna convert this as john::208:johnson,mery,test admin:*:1:johnson,test please help me to create a script for this thanks in advance John (4 Replies)
Discussion started by: johnsonpk
4 Replies

3. Shell Programming and Scripting

How to change date format in file

Hello! I have a textfile that look like this: "83d1:46:2b";"20091008190000";"Rögle BK - Skellefteå";"Swedish" "d4c:46:21";"20091008190000";"Södertälje - Brynäs";"Swedish" "d4b:46:2";"20091008190000";"HV 71 - Färjestad";"Swedish" "838:46:b";"20091010160000";"Skellefteå - HV 71";"Swedish"... (2 Replies)
Discussion started by: condmaster
2 Replies

4. Shell Programming and Scripting

Change file output format

I have a file which has following contents usmtnz-dinfsi19 62 61 18400 18800 99.7 usmtnz-dinfsi19 62 61 18400 18800 99.7 i want the o/p to be like date (7 Replies)
Discussion started by: fugitive
7 Replies

5. Shell Programming and Scripting

howto change format of file?

Hi I have a file with this inside: How can I change it to: thanks a lot regards Israel. (3 Replies)
Discussion started by: iga3725
3 Replies

6. Shell Programming and Scripting

File date format how to change

Hi All, Below are the unix files taken by the help of ls -lrt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 13:33 sand.txt -rw-r--r-- 1 kbehera Domain Users 4 Jul 27 13:37 sand1.txt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 15:30 new_sand.txt -rw-r--r-- 1 kbehera Domain Users 0 Jul 27... (2 Replies)
Discussion started by: krupasindhu18
2 Replies

7. Shell Programming and Scripting

Change the file format

gpio_rw = gpiochip162 audio_aplay = HDMI_0 audio_aplay = HDMI_1 audio_aplay = HDMI_2 graphic_xrandr_show = USB1 graphic_xrandr_show = USB2 graphic_xrandr_show = USB3 graphic_change_resolution = eDP1 gpio_rw = "gpiochip162" audio_aplay = "HDMI_0 HDMI_1 HDMI_2" graphic_xrandr_show =... (3 Replies)
Discussion started by: yanglei_fage
3 Replies

8. Shell Programming and Scripting

Date format change in a csv file

Hi, We have csv file where date is coming in MM/DD/YYYY HH:MM:SS (06/23/2015 20:59:12) in multiple places But we need to change the date format to DD/Mon/YYYY HH:MM:SS (23/Jul/2015 20:59:12) using shell script. Please let us know how can we achieve the same. (16 Replies)
Discussion started by: dholea
16 Replies

9. Shell Programming and Scripting

Shell script change new format on the file.

Hi---Is there's way can write small shell script or perl script open "abc.txt" file and create new "new_abc.txt" file with format output below? Thanks cat abc.txt ###########################Readme############################### Contained with this README.TXT file are all of the file... (7 Replies)
Discussion started by: dotran
7 Replies

10. UNIX for Beginners Questions & Answers

Change date format in a file.

Hi all, I have a file as below, i would like the change the format of the time from "11/7/2019 20:12" to "2019-07-11 20:12:00" in the last coloumn. any awk solution on this. Input: 2,0,695016,1961612,497212,5800804,0,0,161,33,7605,12226,23,10,66,0,0,34,11/7/2019 20:10... (4 Replies)
Discussion started by: Raghuram717
4 Replies
MMV(5)								File Formats Manual							    MMV(5)

NAME
mmv - Memory Mapped Values for Performance Co-Pilot SYNOPSIS
$PCP_TMP_DIR/mmv/<file> DESCRIPTION
The files in $PCP_TMP_DIR/mmv are generated by mmv_stats_init() function from libpcp_mmv library. There could be multiple files in this directory, each file representing a single source of the performance metrics. The metrics are harvested by the mmv PMDA which exports them to the rest of the Performance Co-Pilot infrastructure. FILE FORMAT
Each file starts with the following header: +-------+--------+--------------------------+ |Offset | Length | Name | +-------+--------+--------------------------+ | 0 | 4 | tag == "MMV" | +-------+--------+--------------------------+ | 4 | 4 | Version | +-------+--------+--------------------------+ | 8 | 8 | Generation 1 | +-------+--------+--------------------------+ | 16 | 8 | Generation 2 | +-------+--------+--------------------------+ | 24 | 4 | Number of TOC entries | +-------+--------+--------------------------+ | 28 | 4 | Flags | +-------+--------+--------------------------+ | 32 | 4 | Process identifier (PID) | +-------+--------+--------------------------+ | 36 | 4 | Cluster identifier | +-------+--------+--------------------------+ The generation numbers are timestamps at the time of file creation, and must match for the file to be considered by the MMV PMDA. The flags can specify ways in which the client would like the MMV PMDA to behave - e.g. the MMV_FLAG_PROCESS flag specifies that only if the process identified by PID is currently running should those values be exported. Finally, if set, the cluster identifier is a hint to the MMV PMDA as to what cluster should be used with this application when forming the individual metric identifiers. A performance metric identifier (see PMDA(3)) consists of the PMDA domain number, the cluster number, and the individual item numbers described in the Metrics section. The header is followed by at least 2 TOC sections: one section for metrics and another for values. The TOC section has the following for- mat: +-------+--------+---------------------------------------------+ |Offset | Length | Value | +-------+--------+---------------------------------------------+ | 0 | 4 | Section Type (see mmv_stats.h) | +-------+--------+---------------------------------------------+ | 4 | 4 | Number of entries in the section | +-------+--------+---------------------------------------------+ | 8 | 8 | Section's offset from the start of the file | +-------+--------+---------------------------------------------+ The section types are: 1: Indoms (instance domain definitions) 2: Instances 3: Metrics (metric definitions) 4: Values 5: String The only mandatory sections are Metrics and Values. Indoms and Instances sections only appear if there are metrics with multiple instances. String sections only appear if there are metrics with string values, or when Metrics or Indoms are defined with help text. The entries in the Indoms section have the following format: +-------+--------+--------------------------------------+ |Offset | Length | Value | +-------+--------+--------------------------------------+ | 0 | 4 | Unique serial number for this domain | +-------+--------+--------------------------------------+ | 4 | 4 | Number of entries in the domain | +-------+--------+--------------------------------------+ | 8 | 8 | Offset to first instance | +-------+--------+--------------------------------------+ | 16 | 8 | Short help text offset | +-------+--------+--------------------------------------+ | 24 | 8 | Long help text offset | +-------+--------+--------------------------------------+ The entries in the Instances section have the following format: +-------+--------+-------------------------------+ |Offset | Length | Value | +-------+--------+-------------------------------+ | 0 | 8 | Offset into the indom section | +-------+--------+-------------------------------+ | 8 | 4 | Unused padding (zero filled) | +-------+--------+-------------------------------+ | 12 | 4 | Internal instance identifier | +-------+--------+-------------------------------+ | 16 | 64 | External instance identifier | +-------+--------+-------------------------------+ The entries in the Metrics section have the following format: +-------+--------+-------------------------------+ |Offset | Length | Value | +-------+--------+-------------------------------+ | 0 | 64 | Metric Name | +-------+--------+-------------------------------+ | 64 | 4 | Metric Item (see PMDA(3)) | +-------+--------+-------------------------------+ | 68 | 4 | Metric Type (see mmv_stats.h) | +-------+--------+-------------------------------+ | 72 | 4 | Semantics (see PMAPI(3)) | +-------+--------+-------------------------------+ | 76 | 4 | Dimensions (see PMAPI(3)) | +-------+--------+-------------------------------+ | 80 | 4 | Instance Domain ID | +-------+--------+-------------------------------+ | 84 | 4 | Unused padding (zero filled) | +-------+--------+-------------------------------+ | 88 | 8 | Short help text offset | +-------+--------+-------------------------------+ | 96 | 8 | Long help text offset | +-------+--------+-------------------------------+ The entries in the Values section have the following format: +-------+--------+------------------------------------+ |Offset | Length | Value | +-------+--------+------------------------------------+ | 0 | 8 | pmAtomValue (see PMAPI(3)) | +-------+--------+------------------------------------+ | 8 | 8 | Extra space for STRING and ELAPSED | +-------+--------+------------------------------------+ | 16 | 8 | Offset into the Metrics section | +-------+--------+------------------------------------+ | 24 | 8 | Offset into the Instances section | +-------+--------+------------------------------------+ Each entry in the strings section is a 256 byte character array, containing a single NULL-terminated character string. So each string has a maximum length of 256 bytes, which includes the terminating NULL. SEE ALSO
PCPIntro(1), PMAPI(3), mmv_stats_init(3), pcp.conf(5) and pcp.env(5). Performance Co-Pilot MMV(5)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy