Sponsored Content
Operating Systems Linux How to use a case stmt in a for loop? Post 302907733 by mrn6430 on Tuesday 1st of July 2014 10:29:07 AM
Old 07-01-2014
Wrench How to use a case stmt in a for loop?

How can I merge the move statements with the "FOR" loop to do a move of a file right after it zips it and not wait until all of the files are zipped to move all outisde the for loop.

Here is my current code:

Code:
for file in `ls -rt $svdumpdir/* | grep -v '.gz$' | grep '.gtt$' `
do
  echo "gzip $file"
  gzip -9 $file
done
endsec=`perl -e 'print STDOUT time();' `
runsecs=$(($endsec-$startsec))
timeval=`date`
echo "$timeval:zipped all files within $runsecs seconds"
mv $svdumpdir/lsms4iss_reg1.gtt.gz $npacdir/MW/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg2.gtt.gz $npacdir/MA/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg3.gtt.gz $npacdir/NE/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg4.gtt.gz $npacdir/SE/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg5.gtt.gz $npacdir/SW/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg6.gtt.gz $npacdir/WE/$yyyymmdd.gtt.gz
mv $svdumpdir/lsms4iss_reg7.gtt.gz $npacdir/WC/$yyyymmdd.gtt.gz

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case loop... repeat on bad input?

I'm trying to get a case statement to start over if an undefined option is selected... But I am ata loss on how to actually do it. Here is a quick example of what I have. Echo "1) do this/n 2) Do that/n 3) Quit/n Make a selection/n" Read answer Case answer in 1) Dothid;; 2) Dothat;;... (3 Replies)
Discussion started by: trey85stang
3 Replies

2. UNIX for Dummies Questions & Answers

Please explain the stmt

hi, Please explain the below stmt. P=1234 var1=:/a/b/c/file.dat printf "%s %s\n" "$" "${var1#?}" Output is: 1234 /a/b/c/file.dat What is #? in printf stmt? by using that the first character( : ) of "var1" variable is not displayed in output. How is that? please explain.. ... (1 Reply)
Discussion started by: srilaxmi
1 Replies

3. UNIX for Dummies Questions & Answers

Including case insensitivity into loop command

I have the following piece of code: for file in *csv; do cat $file >> $newfile; done for file in *CSV; do cat $file >> $newfile; done and would like to know how to combine these two rules into one? The combined rule would then include the case insensitivity that I am looking for. (4 Replies)
Discussion started by: figaro
4 Replies

4. Shell Programming and Scripting

Help with awk stmt

Hi All, I have a log file as: cat error.log.tmp1 2010-07-06 23:18:34 Connection Available to xyztestftp.abc.com.my 2010-07-06 23:20:33 Connection Available to xyztestftp.abc.com.my ERROR FTP LOGIN Now I am reading this complete log file if no single occurrence of word "ERROR" (this word... (5 Replies)
Discussion started by: ss_ss
5 Replies

5. Shell Programming and Scripting

Help with Dates and SQl stmt?

hi All Please explain the below statement in RED?What does this mean? perl /HDS/common/operations/Quality_Team/Nirvana/WEEKLY_OOPS/sql_dump.pl --sql "select * from WEEKLY_REPORT order by test_case, type" --username=ddb_qa --password=ddb_qa123 --sid=pldeldb --output... (1 Reply)
Discussion started by: SVS_2017
1 Replies

6. Shell Programming and Scripting

Help With Loop in Case Statement script

I am writing a bash script that asks the user for input and I need it to repeat until the user selects quit.. I dont know how to write the loop for it I searched all over but i still do not get it.. if anyone could help with this it would be greatly apprciated here is my script so far: #!... (2 Replies)
Discussion started by: Emin_Em
2 Replies

7. Shell Programming and Scripting

Case Stmt - Need Help Urgently

Hello All, Need help urgently.. i have a scenario where i have two files 1) mireport_20111406.txt 2) PRLIHSP01_8080.2011-06-11-15_26_31 ---------- I want a query something similar to this algorithm :- Case when file_name is like mireport then extract_date=14-06-2011 when... (4 Replies)
Discussion started by: iamnoone
4 Replies

8. Shell Programming and Scripting

Case loop condition

hello, I would like to do exit at the end ie list all errors before exiting How to put the token exit in a variable with a loop ? Thanks function g1 () { case "$1" in (-0-0 | -0-1 | -0-2 | -0-3 | -1-0 | -1-1 | -1-2 | -1-3) # nothing, OK ! ;; (*) echo 'Fatal, $1 = '"'$1'"', Date... (9 Replies)
Discussion started by: amazigh42
9 Replies

9. Shell Programming and Scripting

Case sensitive in If loop .

Hi All, select app from the menu: ABC DEF GHI JKL ALL # ALL will select all the apps in the menu echo "Enter your option" read option; if then <execute the below command> elif # option is the 1 selection from menu...not ALL <execute the below command> else (14 Replies)
Discussion started by: Devaraj A
14 Replies
TGTT(1) 						      General Commands Manual							   TGTT(1)

NAME
tgtt - Tool for Generic Textual Trees SYNOPSIS
tgtt [options] [tree] DESCRIPTION
tgtt is an X11/Motif based graphical editor for drawing generic textual trees. Trees can be loaded from and stored to a file. It can print trees to a PostScript printer or save as PostScript to a file. tgtt is part of The Toolkit for Conceptual Modeling (TCM). ARGUMENTS
You can call tgtt with a single tree name as argument. If this argument is an existing file then tgtt tries to load a tree from it. If it does not exist, a new tree is created with the argument as tree name. tgtt files should have suffix '*.gtt'. Without a tree argument, tgtt creates a new empty generic tree with the name 'untitled.gtt'. In addition to the standard X11 toolkit options (see X11(7)) tgtt accepts the options listed below: -drawing widthxheight Create a drawing area of width pixels wide and height pixels high. -help Write all available options to standard output and quit. -maxdrawing widthxheight The drawing area can not be larger than width pixels wide and height pixels high. -priv_cmap Start the editor with a private colormap. -projdir directory Set the project directory (current working directory) to directory. -toEPS [file.eps] Generate EPS (to file.eps or stdout when no file name was given) and quit. -toFig [file.fig] [-latex] Generate Fig format (to file.fig or stdout when no file name was given and quit. When the -latex option is given, LaTeX fonts are generated, otherwise normal PostScript fonts are generated. The Fig format can be read by xfig(1) and fig2dev(1). -toPNG file.png Generate PNG format to file.png and quit. -toPS [file.ps] Generate PostScript (to file.ps or stdout when no file name was given) and quit. -version Write the TCM version to standard output and quit. ENVIRONMENT
The TCM_HOME environment variable should be the directory where the TCM files are installed. PATH Should include $TCM_HOME/bin MANPATH Should include $TCM_HOME/man PRINTER Name of the default printer that is used by tgtt. LD_LIBRARY_PATH Should include $TCM_HOME/lib when the distribution contains shared object libraries in $TCM_HOME/lib. FILES
The following relative files are relative to $TCM_HOME. bin/tgtt the generic textual tree editor. bin/psf a program to filter PostScript output. lib/banner.ps PostScript banner page that can be used when the printer does not print a banner page. lib/help/* The help directory contains a collection of text files for the on-line help. lib/TCM X Resources (the same as the ones that are built-in). You can customize the fonts and colors by setting resources in your X defaults database. Each string of the form ``TCM.resource:definition'' sets a resource. /tmp/tcmXXXXXX Pseudo random temporary file, for PostScript output. lib/tcm.conf TCM editor configuration file. This file contains values for some of the editor defaults like the page size, the default fonts etc. This file is read by each editor upon startup. $HOME/.tcmrc Each user of TCM can override some of the options of tcm.conf by its own configuration file, installed in $HOME/.tcmrc. SEE ALSO
Frank Dehne, Roel Wieringa and Henk van de Zandschulp -- TCM (Toolkit for Conceptual Modeling), User's Guide and Reference. This document is available as PostScript and HTML in $TCM_HOME/doc or as HTML via the URL http://www.cs.utwente.nl/~tcm/tcm-usersguide.html. tcm(1), X11(7), xfig(1), fig2dev(1) AUTHOR
Frank Dehne (frank@cs.vu.nl). BUGS
Please send bug reports to tcm@cs.utwente.nl. 9 January 2000 TGTT(1)
All times are GMT -4. The time now is 09:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy