Sponsored Content
Top Forums Shell Programming and Scripting Need to grep this Data in proper format:- Please Guide Post 302878813 by manalisharmabe on Monday 9th of December 2013 06:30:34 AM
Old 12-09-2013
Quote:
Originally Posted by pravin27
Code:
sudo /usr/openv/netbackup/bin/admincmd/bpmedialist -mcontents -m ADC020 -L | awk -F"=" '/^backup_id/{$1="";backup_id[++i]=$0}
/^creation/{$1="";creation[i]=$0}
/^expiration/{$1="";expiration[i]=$0}
/^media_id/{$1="";media_id[i]=$0}
/^policy/{$1="";policy[i]=$0}
/^sched_label/{$1="";sched_label[i]=$0}
END { print "Media_id |backup_id | Policy | sched_label | creation | expiration";for(j=1;j<=i;j++) {
print media_id[j]"|"backup_id[j]"|"policy[j]"|"sched_label[j]"|"creation[j]"|"expiration[j]
}}'

Wow! Looks fine.

You mean to say I need to create a script for this?
But I need to yun this for almost 100 Tape numbers ADC001 too ADC100.
My machine is production machine.Smilie The backup ServerSmilie

However I have one tiny query, i searched google a lot but did not get answer,
how to grep word only once without repeating

Code:
-bash-3.00$ cat /zFINAL142TAPES/ADC094.txt  | grep policy  intel_class_i
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = ams_linux_prod1
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win7
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win2008_2
policy = intel_class_win200

Please advise

---------- Post updated at 05:00 PM ---------- Previous update was at 04:34 PM ----------

Hey Hi Pravin,

Can I directly copy paste and run the above given code on command line to get desired output or do I need to create script for that?

Please advise.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check for proper e mail id format

Hi, We run an application called meta which reads user information from database and updates in LDAP.For that we have some scripts to check the uniqueness of mail ids between the existing LDAP and Database.It works fine when people enter mail ids in proper format (xxx.yyy@abc.com) but if it... (2 Replies)
Discussion started by: prolay
2 Replies

2. BSD

proper syntax of grep command

I'm learning UNIX on my mac (BSD), using a manual. I'm trying to figure out the grep command, and am getting something wrong. I've opened one of my files in NeoOffice and am looking for a string, the phrase 'I am writing.' I've been to some sites to get the proper syntax, and from what I can see... (5 Replies)
Discussion started by: Straitsfan
5 Replies

3. Shell Programming and Scripting

Net::SSH::Perl ...... how to print the output in a proper format

Hi Guys, my $cmd = "ls -l"; #........ {or let it be as # my $cmd= "ls"; } my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output getting displayed in a... (7 Replies)
Discussion started by: gsprasanna
7 Replies

4. Shell Programming and Scripting

Output file not displayed in the proper format

Hi am using uuencode fro attaching one report which is nothing but sql query output. But when i receive the report through attachement and when it is opened the report is not displayed in proper format. Means if the sql query has 100 rows the mail attachment report displays the report in 2... (2 Replies)
Discussion started by: weknowd
2 Replies

5. Shell Programming and Scripting

Getting Proper Date Format in SH Script

There's a small SH script I'm trying to write where it will get the current month and find a log file that is based on the date. Example: Today is February, so the log file is going to be 201102.log (2011 + 02) An additional thing is that if today is the 1st of a month, it will also find the log... (3 Replies)
Discussion started by: kooshi
3 Replies

6. Shell Programming and Scripting

Need to split a xml file in proper format

Hi, I have a file which has xml data but all in single line Ex - <?xml version="1.0"?><User><Name>Robert</Name><Location>California</Location><Occupation>Programmer</Occupation></User> I want to split the data in proper xml format Ex- <?xml version="1.0"?> <User> <Name>Robert</Name>... (6 Replies)
Discussion started by: avishek007
6 Replies

7. Shell Programming and Scripting

Awk - Summation in Proper decimal Format

Hi I am executing below command to do summation on 46th coloumn. cat File1| awk -F"|" '{p += $46} END { printf"Column Name | SUM | " p}' I am getting output as Column Name | SUM | 1.01139e+10 Here I want output in Proper decimal format. Can someone tell me what change is required for same? (1 Reply)
Discussion started by: sanranad
1 Replies

8. Shell Programming and Scripting

Combine multiline to one line with proper format

Hello Guys, I have a file say FILE1.txt contains below data:- A B C D E F G H I J K L I need the output in another file as FILE2 as:- 'A', 'B', 'C', 'D', 'E', (7 Replies)
Discussion started by: jassi10781
7 Replies
BACKUP_LISTDUMPS(8)					       AFS Command Reference					       BACKUP_LISTDUMPS(8)

NAME
backup_listdumps - Displays the dump hierarchy from the Backup Database SYNOPSIS
backup listdumps [-localauth] [-cell <cell name>] [-help] backup listd [-l] [-c <cell name>] [-h] DESCRIPTION
The backup listdumps command displays the dump hierarchy from the Backup Database. OPTIONS
-localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more details, see backup(8). -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8). -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output displays the complete dump hierarchy and indicates the relationship between full and incremental dump levels. Full dump levels appear at the left margin. The hierarchy can include more than one full dump level; each one defines a subhierarchy of dump levels that can be used for dumping different volume sets. Incremental dump levels appear below and indented to the right of their parent dump levels, which can be either full or incremental. Since multiple incremental dump levels can share the same parent, an incremental dump level is not always directly below its parent; the amount of indentation indicates the parent/child relationship. If a dump level has an associated expiration date, it appears along with the level name. Absolute expiration dates appear in the format <dump_level> expires at <day month date time year> and relative expiration dates in the format <dump_level> expires in {<years>y | <months>m | <days>d} to indicate the number of years, months, days, or combination of the three after creation a dump expires when created at this level. EXAMPLES
The following example depicts six dump hierarchies. The expiration date for all incremental dump levels is 13 days so that the corresponding tapes can be recycled two weeks after their creation. The expiration dates for all full dump levels is 27 days so that the corresponding tapes can be recycled four weeks after their creation. % backup listdumps /week1 expires in 27d /tuesday expires in 13d /thursday expires in 13d /sunday expires in 13d /tuesday expires in 13d /thursday expires in 13d /week3 expires in 27d /tuesday expires in 13d /thursday expires in 13d /sunday expires in 13d /tuesday expires in 13d /thursday expires in 13d /sunday1 expires in 27d /monday1 expires in 13d /tuesday1 expires in 13d /wednesday1 expires in 13d /thursday1 expires in 13d /friday1 expires in 13d /sunday2 expires in 27d /monday2 expires in 13d /tuesday2 expires in 13d /wednesday2 expires in 13d /thursday2 expires in 13d /friday2 expires in 13d /sunday3 expires in 27d /monday1 expires in 13d /tuesday1 expires in 13d /wednesday1 expires in 13d /thursday1 expires in 13d /friday1 expires in 13d /sunday4 expires in 27d /monday2 expires in 13d /tuesday2 expires in 13d /wednesday2 expires in 13d /thursday2 expires in 13d /friday2 expires in 13d PRIVILEGE REQUIRED
The issuer must be listed in the /etc/openafs/server/UserList file on every machine where the Backup Server is running, or must be logged onto a server machine as the local superuser "root" if the -localauth flag is included. SEE ALSO
backup(8), backup_adddump(8), backup_deldump(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BACKUP_LISTDUMPS(8)
All times are GMT -4. The time now is 01:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy