The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Awk:Find length of string omitting quotes jayakumarrt Shell Programming and Scripting 2 05-09-2008 04:48 AM
omitting lines from file A that are in file B gneen Shell Programming and Scripting 14 02-20-2008 05:33 AM
Get the words.. kakashi_jet Shell Programming and Scripting 10 07-31-2006 10:30 AM
Omitting some filenames for commands to process milhan Shell Programming and Scripting 5 05-19-2006 07:49 PM
Extracting only Alphabets from a value amitkhiare UNIX for Advanced & Expert Users 2 02-22-2006 03:24 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-27-2009
coolrekz coolrekz is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
Post Omitting the last 2 alphabets in the words

Hi Guys,

Bit new to Unix shell scripting so this question might seems little kiddish for you.

what im trying to achieve here is :

I have file which is compressed like Account_52320090605076_log.Z

so in my shell script i call this file also as one of my parameters

like

./Information.sh DBNAME USERNAME DIREC_LOC Account_52320090605076_log.Z

what i need here is

1. Check if the file has a .Z or .z at its end .
if yes then
uncompress it

after uncompress the DUMPFILE_NAME should have a new paramater without the .Z extension

2. If no then proceed with the next step


my script looks like this

#!/bin/ksh

DB_NAME=$1
USER_NAME=$2
DIR_LOC=$3
DUMPFILE_NAME=$4
LINE=$DUMPFILE_NAME; export LINE
VAR=`echo $LINE |awk -F. '{print $3}`;export VAR
echo $VAR


if [ "$VAR" = "z" ] || [ "$VAR" = "Z" ]
then

uncompress $DUMPFILE_NAME

chmod 744 `echo $LINE |awk -F. '{print $1"."$2}'`

DUMPFILE_NAME=$LINE |awk -F. '{print $1"."$2}' ; export DUMPFILE_NAME

echo $DUMPFILE_NAME

fi

echo $DUMPFILE_NAME


but it seems like lines doesn't fetch me the correct result , could some one help and let me know a correct command that i can use for this situation.

thx
rekz
 

Bookmarks

Tags
alphabets, omitting, rekz

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0