Sponsored Content
Top Forums Shell Programming and Scripting Extra/parse lines from a file between unque lines through the file Post 302281221 by jouuu on Wednesday 28th of January 2009 11:42:20 AM
Old 01-28-2009
I appreciate your help. Can that be applied a file with the following content.
datactr@acuransx:nbemmcmd -listmedia -mediaid 103549
NBEMMCMD, Version:6.5
====================================================================
Media GUID: c9f01152-eb8a-11dd-8000-9a518a76e394
Media ID: 103549
Partner: -
Media Type: HCART2
Volume Group: ---
Application: Netbackup
Media Flags: 1
Description: Rules for LTO Tapes
Barcode: 103549
Partner Barcode: --------
Last Write Host: legend
Created: 01/26/2009 14:22
Time Assigned: 01/27/2009 16:15
First Mount: 01/27/2009 16:07
Last Mount: 01/28/2009 07:02
Volume Expiration: -
Data Expiration: 02/27/2009 07:00
Last Written: 01/28/2009 07:00
Last Read: -
Robot Type: NONE
Robot Control Host: -
Robot Number: -
Slot: -
Side/Face: -
Cleanings Remaining: -
Number of Mounts: 11
Maximum Mounts Allowed: 0
Media Status: ACTIVE
Kilobytes: 192549351
Images: 11
Valid Images: 11
Retention Period: 2
Number of Restores: 0
Optical Header Size Bytes: 1024
Optical Sector Size Bytes: 0
Optical Partition Size Bytes: 0
Last Header Offset: 2136502
Adamm Guid: 00000000-0000-0000-0000-000000000000
Rsm Guid: 00000000-0000-0000-0000-000000000000
Origin Host: NONE
Master Host: acuransx
Server Group: UNRESTRICTED_SHARING_GROUP
Upgrade Conflicts Flag:
Pool Number: 8
Volume Pool: LTO-Tapes
Previous Pool Name: -
Vault Flags: -
Vault Container: -
Vault Name: -
Vault Slot: -
Session ID: -
Date Vaulted: -
Return Date: -

Where "^Media GUID:" is the start and "^Return Date" is finish and I want to extract any number or lines to be displayed across one line.
example output
Media ID,Media Status,Media Type,Data Expiration,Return Date
103549,ACTIVE,HCART2,02/27/2009 07:00,-

Netbackup has several commands that output data in this format. I was hoping for syntax that i could change start and finish lines and continue to extract lines between them.

Again thanks for you help with this JoeG.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove extra lines in the file

Hi, I have some files, with some extra lines in weird characters on the top and bottom of the. I want to get rid of those line. Is there a way I can do that? example of the input file. I want to get rid of those lines in bold  ... (8 Replies)
Discussion started by: CamTu
8 Replies

2. Shell Programming and Scripting

Need to parse file "x" lines at a time ... awk array?

I have files that store multiple data points for the same device "vertically" and include multiple devices. It repeats a consistant pattern of lines where for each line: Column 1 is a common number for the entire file and all devices in that file Column 2 is a unique device number Column 3 is... (7 Replies)
Discussion started by: STN
7 Replies

3. Shell Programming and Scripting

Parse a file to display lines containing a word

Hi! I'm trying to create a shell script to parse a file which might have multiple lines matching a pattern (i.e. containing some word). I need to return all lines matching the pattern, but stripping the contents of that line until the pattern is matched For example, if my input file was ... (4 Replies)
Discussion started by: orno
4 Replies

4. Shell Programming and Scripting

Need to parse lines in a file into two words and assign the values to two variables

For example, I have a file with below lines containing VOB tags and VOB paths. * /vobs/fts/FTSUSM20_VOB /ccvobsslx01/projects/vobs/eml/FTSUSM20_VOB * /vobs/fts/FTS20_VOB /ccvobsslx01/projects/vobs/eml/FTS20_VOB * /vobs/pmv/PMS_VOB /ccvobsslx01/projects/vobs/cpm/_/PMS_VOB *... (4 Replies)
Discussion started by: senthilkc
4 Replies

5. Shell Programming and Scripting

Parse large file on line count (random lines)

I have a file that needs to be parsed into multiple files every time there line contains a number 1. the problem i face is the lines are random and the file size is random. an example is that on line 4, 65, 187, 202 & 209 are number 1's so there has to be file breaks between all those to create 4... (6 Replies)
Discussion started by: darbs121
6 Replies

6. Shell Programming and Scripting

Extract some lines from one file and add those lines to current file

hi, i have two files. file1.sh echo "unix" echo "linux" file2.sh echo "unix linux forums" now the output i need is $./file2.sh unix linux forums (3 Replies)
Discussion started by: snreddy_gopu
3 Replies

7. Shell Programming and Scripting

Check/Parse log file's lines using time difference/timestamp

I was looking at this script which outputs the two lines which differs less than one sec. #!/usr/bin/perl -w use strict; use warnings; use Time::Local; use constant SEC_MILIC => 1000; my $file='infile'; ## Open for reading argument file. open my $fh, "<", $file or die "Cannot... (1 Reply)
Discussion started by: cele_82
1 Replies

8. Shell Programming and Scripting

Consolidate several lines of a CSV file with firewall rules, in order to parse them easier?

Consolidate several lines of a CSV file with firewall rules Hi guys. I have a CSV file, which I created using an HTML export from a Check Point firewall policy. Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or... (4 Replies)
Discussion started by: starriol
4 Replies

9. Shell Programming and Scripting

Removing extra lines from file

I have a file where data looks like this: === <?xml version="1.0" encoding="utf-8"?> <xml xmlns:s='uuid:XYZ' xmlns:dt='uuid:ABC' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'> <s:Schema id='RowsetSchema'> <s:ElementType name='row'... (7 Replies)
Discussion started by: vx04
7 Replies

10. Shell Programming and Scripting

Find all lines in file such that each word on that line appears in at least n lines of the file

I have a file where every line includes four expressions with a caret in the middle (plus some other "words" or fields, always separated by spaces). I would like to extract from this file, all those lines such that each of the four expressions containing a caret appears in at least four different... (9 Replies)
Discussion started by: uncleMonty
9 Replies
All times are GMT -4. The time now is 05:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy