User:Redneck2u

From Wikipedia, the free encyclopedia

Setting up Shell Script project in eclipse:

Pre-Requisite:

  • Eclipse Helios - 3.6.2 or
  • Eclipse Indigo - 3.7.1

Via Help > Install New Software

  1. DLTK & H2 core framework from http://download.eclipse.org/technology/dltk/updates
  2. Man viewer tool from http://download.eclipse.org/technology/linuxtools/update
  3. ShellEd from http://sourceforge.net/apps/trac/shelled/wiki/ShellEd

CVS Commands

  • cvsReleaseCreate
  • cvsBranchAdd -r br_REL-112611 com/lowes/ss/tools/sisor/
  • cvsBranchCheckout -r br_REL-112611 com/lowes/ss/tools/sisor/
  • cvsBranchDelete -r br_REL-112611 com/lowes/ss/tools/sisor/
  • cvs update
  • rm -f exfixtruck;cvs delete exfixtruck
  • cvs add ckbal
  • cvs commit

Info CVS Commands

  • cvsBranchInfo -r br_REL-112611 (Get details related to a branch)

Order of CVS Commands:

  • cvs login
  • cvsReleaseCreate (for a brand new Package)
  • cvsBranchAdd (for a adding another module to existing branch)
  • cvsBranchCheckout
  • cvsBranchCommit
  • cvs update

Useful Shell Commands

  • Replace Tabspace with 8 blank spaces
    • pr -t -e8 parmGen.sh > parmGen.sh.bak
  • How to "test" shell script without running it?
    • sh -n <shellscript.sh>
  • Replace Trailing zeoes in CSV
    • sed 's/0\{1,10\}@/0@/g'|sed 's/\.0\{1,10\}$/.0/g'
  • Search for files containing strings in Dev52 Local src:
    • find . -type f -exec grep -i "WHZI070A" '{}' \;
    • find . -type f |xargs grep -i "WHZI070A"

Ksh Regular Expressions

Ksh has it's own regular expressions. Use an * for any string. So to get all the files ending it .c use *.c. A single character is represented with a ?. So all the files starting with any sign followed bye 44.f can be fetched by: ?44.f.

Especially in ksh there are quantifiers for whole patterns:

  • ?(pattern) matches zero or one times the pattern.
  • *(pattern) matches any time the pattern.
  • +(pattern) matches one or more time the pattern.
  • @(pattern) matches one time the pattern.
  • !(pattern) matches string without the pattern.

So one can question a string in a variable like: if $var = fo@(?4*67).c ;then ...


Useful Vi Shortcuts

  • In Vi: Jump to 519 line from current position
    • type :519j
  • In Vi: Junp to 519 line in file
    • type :519G

Debug/Test Scripts

  • /home/roc/userdata/input/sisor_test/utils/makeMenu.sh - Builds menuFlatFile
  • /home/roc/userdata/input/sisor_test/test_sisor - SISOR only version

Misc. Info

  • To look at the on-hold requests that need to be approved in roc: cd /home/login/roc/inprog; ls *.HOLD
  • To look at what users are approved as approvers for the users: cd /home/login/roc/etc;grep ":s0998jb2" users

Useful Perl commands

  • To find a list of all Installed Perl Modules:
    • perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \
    • 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
  • To make First character Uppercase:
    • perl -ane ' foreach $wrd ( @F ) { print ucfirst($wrd); } '

DB2 commands

  • To list all Local DB2 database instances on a server
    • db2 list db directory | grep -vp Remote
  • To run a simple SQL command
    • echo "connect to lowes user storemnt using `dbPass storemnt` @
    • set current schema=dbo@" | db2 +p -xtd@ > /dev/null;
    • db2 -x "select * from T2150"
  • To List user table in DB2:
    • lsql "select distinct tabname, tabschema from syscat.tables where tabschema = 'DBO' "
  • To List structure of table:
    • db2 -x "describe select * from dbo.T2150"
    • db2 -x "describe table dbo.T2150"
  • To dump data in DB2 specifying a Delimiter
    • db2 -x "export to 'testdump.dat' OF DEL MODIFIED BY COLDEL, select * from dbo.T2150"
    • db2 -x "export to 'testdump.dat' OF DEL MODIFIED BY COLDEL, select SHT_DES_TXT, UPD_ID from dbo.T2150"
  • To unload table data in DB2
    • db2 -x "EXPORT TO 'T1297A.unl' OF DEL select * from T1297A where T024_ITM_NBR IN (126, 146, 578)"
  • To load file data to table in DB2
    • db2 -x "import from 'T1297A.unl.126' OF DEL insert into T1297A"
    • echo "import from WHZT040A.38173.unl OF DEL insert into WHZT040A"|sql_udb

Note:

  • Using sql_udb or lsql does not need you to start DB2 session.
  • For simple db2, you will need to start a session (and end it).
  • lsql will not work for export/insert/delete (any Db modify statements)

Using Local Store Menu

  • To Generate MRZR310A report: From the menu, option 01.05.05.02

Code Propagation in Lowes via CVS

File:Code propagation.png


Qt in Cygwin

  1. I installed "KDE on Cygwin" by extracting the tar file in the root directory (creating /usr/lib/qt3/*).
  2. Create a ~/.profile file containing:
    1. QTDIR=/usr/lib/qt3
    2. PATH=$QTDIR/bin:$PATH
    3. MANPATH=$TQDIR/man:$MANPATH
    4. LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    5. export QTDIR PATH MANPATH LD_LIBRARY_PATH
  3. Create the QT application in a selected directory:
  4. Compile and run using
    1. qmake -project
    2. qmake
    3. make

Category:Lowe's