Sponsored Content
Top Forums Shell Programming and Scripting Need your help to get the output of the list in desired format Post 302541833 by rohit22hamirpur on Tuesday 26th of July 2011 01:03:40 AM
Old 07-26-2011
thanks this code is working fine for me but my script 2nd option "Check for Repository latest codebase" need repository name but I don't want this I want the user just only enter the option like 1 to 31(1....31) neither name of the repositiry.Please suggest.


1)BSB 2)CIB 3)COB 4)DCI 5)DIB 6)DSB 7)ESB-P 8)ESB-TOOLS 9)FareVerify 10)GCACHE 11)GWY 12)IBMSOAMB 13)IBMSOAWAS 14)ISM 15)KESTREL-DEV 16)kestrel-migration 17)KESTREL-UAPI 18)KESTREL-XD 19)LAMB 20)LinuxAutomation 21)MGLNO 22)PORTAL 23)repos4 24)SCMTools 25)SESTOKEN 26)SMB 27)SOA 28)SPLASH 29)SSB 30)STP 31)TOI

Enter options from 1 to 4


1 Check for Repository list

2 Check for Repository latest codebase

3 Check for Repository User's list for contributors and users

4 Exit

Select Menu Number [ 1 - 4 ]:

Press 2 and

Enter the repository name :
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

capturing the time stamp in desired format

Hello All, I am working on korn shell script.i have 2 questions; 1) I have a file and i am able to capture the arrival time. the arrival time is capturing as 11:30 ls -ltr aaa.bbb.332121312.*.* | awk -F" " '{print $8}' 11:30 my desired output is 113000 can anyone please suggest me... (2 Replies)
Discussion started by: pavan_test
2 Replies

2. UNIX for Advanced & Expert Users

get the timestamp of a file in desired format

Hi, I have a file say abc. I get the timestamp in following way: ls -ltr abc | awk -F" " '{print $6,$7,$8}' Mar 8 10:23 I need to get the timestamp as : 03-08-2007 10:23:00 Thanks Sumeet (1 Reply)
Discussion started by: sumeet
1 Replies

3. Shell Programming and Scripting

Help me in getting the desired output

I wanted to put "|" this sign at starting and at end of every field but its not working with first field like Currently the out put is : abc | abc | abc | xyz | xyz | xyz | But I want the out put in this form: | abc | abc | abc | | xyz | xyz | xyz | plz help me. (2 Replies)
Discussion started by: akash
2 Replies

4. HP-UX

Desired Format !

Hi everybody, I just need desired ouput from text file which should have folowing format; "2007-06-25 00:03:32.926+05:30",12354369,"Load","Completed","Rs.-5,556.00",9452217714 "2007-06-25 00:06:57.357+05:30",12354371,"Load","Completed","Rs.-56.00",9415766266 "2007-06-25... (1 Reply)
Discussion started by: prasanth_babu
1 Replies

5. Shell Programming and Scripting

SED - output not desired

echo '0x3f 0xfa ae 0xeA' | sed '/0x/ y/abcdef/ABCDEF/' output: 0x3F 0xFA AE 0xEA echo '0x3f 0xfa ae 0xeA' | sed -r '/0x{2}/ y/abcdefg/ABCDEFG/' output: 0x3F 0xFA AE 0xEA my expected output: 0x3F 0xFA ae 0xEA What I want to achieve is change all hexadecimals to UPPER case(only those... (6 Replies)
Discussion started by: kevintse
6 Replies

6. Shell Programming and Scripting

need to get the desired output

Below is the my cide which is working fine but I am not getting the output indesired format.there is some problem in alignment.Can someone help me to correct this? if ]; then summary=$( echo -e "Please review the log file of auto coloclean utility.\n"; echo -e... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

7. UNIX for Dummies Questions & Answers

Help with saving file in desired format

Hi I have the following file in the unix named emp. ID,NAME,SAL,DEPT 101,aaa,2000,10 102,bbb,3000,20 103,ccc,4000,30 104,ddd,5000,40 105,aaa,2000,50 106,bbb,3000,60 107,ccc,4000,70 108,ddd,5000,10 109,aaa,2000,80 I need to save first 3 columns(ID, NAME, SAL) in another file with... (2 Replies)
Discussion started by: alok3141
2 Replies

8. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

9. UNIX for Dummies Questions & Answers

How to print the line from the file in the desired format:?

I am reading a file of Linux ( like mentioned below) & the data is represented in a single line like mentioned below: 11/03 4:00 39992 0.098 5.195 0.034 0.001 1.091 182 0.000 0 0.071 4.252 0.033 0.001 666.53 Now i want to print the result in other file something like this :- 39992... (5 Replies)
Discussion started by: Anamica
5 Replies

10. Shell Programming and Scripting

Desired Date format

I need to get the current year for the files that has been created today. Ex- when i list in unix console it shows ls -l abc.txt -rw-rw-r-- 1 user1 user1 33 May 2 08:58 abc.txt but i need to get as May 2 2013 , i dont need 08:58 is there any command to list it out in that... (7 Replies)
Discussion started by: Prashanth B
7 Replies
Git::Repository::Tutorial(3pm)				User Contributed Perl Documentation			    Git::Repository::Tutorial(3pm)

NAME
Git::Repository::Tutorial - Control git from Perl using Git::Repository SYNOPSIS
use Git::Repository; # do cool stuff with Git, using the following advice HOW-TO A "Git::Repository" object represents an actual Git repository, against which you can run commands. Obtain a Git::Repository object from an existing repository If your script is expected to run against a repository in the current directory (like most Git commands), let "Git::Repository" handle the magic: $r = Git::Repository->new(); If the repository has a working copy (work tree): $r = Git::Repository->new( work_tree => $dir ); If the repository is a bare repository, or you prefer to provide the .git directory location: $r = Git::Repository->new( git_dir => $gitdir ); If the work tree and the git directory are in unrelated locations, you can also provide both: $r = Git::Repository->new( work_tree => $dir, git_dir => $gitdir ); The constructor also accepts an option hash. The various options are detailed in the manual page for "Git::Repository::Command". Run any git command Git commands can be run against an existing "Git::Repository" object, or against the class itself (in which case, git will try to deduce its context from the current directory and the environment). The pattern for running commands is always the same: $r->run( $command => @arguments, \%options ); The $command and @arguments are identical to those you'd pass to the "git" command-line tool. The options hash contains options, as described in the manual page for "Git::Repository::Command". Create a new repository Sometime, you'll need to create the Git repository from scratch: # git version 1.6.5 and above Git::Repository->run( init => $dir ); $r = Git::Repository->new( work_tree => $dir ); # any older git requires the command to be run in the work tree, # so we use the cwd option Git::Repository->run( init => { cwd => $dir } ); $r = Git::Repository->new( work_tree => $dir ); Note that the old "create()" method is obsolete, warns and will be removed in a future version. Clone a repository Cloning works the same way: Git::Repository->run( clone => $url => $dir ); $r = Git::Repository->new( $dir ); Run a simple command When you don't really care about the output of the command, just call it: $r->run( add => '.' ); $r->run( commit => '-m', 'my commit message' ); In case of an error or warning, "Git::Repository" will "croak()" or "carp()" appropriately. Process normal and error output The "run()" command doesn't capture stderr: it only warns (or dies) if something was printed on it. To be able to actually capture error output, "command()" must be used. my $cmd = $r->command( @cmd ); my @errput = $cmd->stderr->getlines(); $cmd->close; "run()" also captures all output at once, which can lead to unnecessary memory consumption when capturing the output of some really verbose commands. my $cmd = $r->command( log => '--pretty=oneline', '--all' ); my $log = $cmd->stdout; while (<$log>) { ...; } $cmd->close; Of course, as soon as one starts reading and writing to an external process' communication handles, a risk of blocking exists. Caveat emptor. Provide input on standard input Use the "input" option: my $commit = $r->run( 'commit-tree', $tree, '-p', $parent, { input => $message } ); Change the environment of a command Use the "env" option: $r->run( 'commit', '-m', 'log message', { env => { GIT_COMMITTER_NAME => 'Git::Repository', GIT_COMMITTER_EMAIL => 'book@cpan.org', }, }, ); See Git::Repository::Command for other available options. Process the output of git log When creating a tool that needs to process the output of git log, you should always define precisely the expected format using the --pretty option, and choose a format that is easy to parse. Assuming git log will output the default format will eventually lead to problems, for example when the user's git configuration defines "format.pretty" to be something else than the default of "medium". Process the output of git shortlog git shortlog behaves differently when it detects it's not attached to a terminal. In that case, it just tries to read some git log output from its standard input. So this oneliner will hang, because git shortlog is waiting for some data from the program connected to its standard input (the oneliner): perl -MGit::Repository -le 'print scalar Git::Repository->run( shortlog => -5 )' Whereas this one will "work" (as in "immediately return with no output"): perl -MGit::Repository -le 'print scalar Git::Repository->run( shortlog => -5, { input => "" } )' So, you need to give git shortlog some input (from git log): perl -MGit::Repository -le 'print scalar Git::Repository->run( shortlog => { input => scalar Git::Repository->run( log => -5 ) } )' If the log output is large, you'll probably be better off with something like the following: use Git::Repository; # start both git commands my $log = Git::Repository->command('log')->stdout; my $cmd = Git::Repository->command( shortlog => -ens ); # feed one with the output of the other my $in = $cmd->stdin; print {$in} $_ while <$log>; close $in; # and do something with the output print $cmd->stdout->getlines; Wrap git in a sudo call If for a given repository you want to wrap all calls to git in a "sudo" call, you can use the "git" option with an array ref: my $r = Git::Repository->new( { git => [qw( sudo -u nobody git )] } ); In this case, every call to git from $r will actually call "sudo -u nobody git". Use submodules Because "Git::Repository" automatically sets the "GIT_DIR" and "GIT_WORK_TREE" environment variables, some "submodule" sub-commands may fail. For example: $r->run( submodule => add => $repository => 'sub' ); will give the following error: error: pathspec 'sub' did not match any file(s) known to git. To avoid this error, you should enforce the removal of the "GIT_WORK_TREE" variable from the environment in which the command is run: $r->run( submodule => add => $repository => 'sub', { env => { GIT_WORK_TREE => undef } } ); Note that "System::Command" version 1.04 is required to be able to remove variables from the environment. Sort git versions Basically, you need to recreate the "cmp" operator for Git versions, using the private "_version_gt()" method (which accepts two parameters): @sorted_versions = sort { Git::Repository::_version_gt( $a, $b ) || -Git::Repository::_version_gt( $b, $a ) } @versions; AUTHOR
Philippe Bruhat (BooK), "<book at cpan.org>" COPYRIGHT
Copyright 2010-2011 Philippe Bruhat (BooK), all rights reserved. LICENSE
This documenation is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-12-28 Git::Repository::Tutorial(3pm)
All times are GMT -4. The time now is 02:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy