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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to format a .CSV data Uday1982 Shell Programming and Scripting 8 02-04-2008 02:28 AM
extract data from xml- shell script using awk nishana Shell Programming and Scripting 5 07-16-2007 06:20 AM
Help with a shell script to concatenate lists together rfourn Shell Programming and Scripting 1 07-05-2007 07:14 PM
shell script for log files data! rvrao77 Shell Programming and Scripting 6 11-30-2006 07:03 AM
Failed to concatenate parameter in k-shell nir_s Shell Programming and Scripting 1 05-23-2005 02:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-07-2005
Registered User
 

Join Date: Sep 2001
Location: Mumbai
Posts: 3
How to cut, concatenate data in Shell Script

Hello All,,
I'm very new to Unix and I'm more in SAP ABAP. I have a requirement for a shell script which will accept one parameter as Input file name(with directory)
e.g : /sapdata/deubank/dbdirect/out/deu01deupe/in/deu01deupe20051207111320.pmt

In the shell script I have to make two more parameters as
a> outfile = /sapdata/deubank/dbdirect/out/deu01deupe/out/deu01deupe20051207111320.pmt
and
b>chkfile = /sapdata/deubank/dbdirect/out/deu01deupe/chk/chkdeu01deupe20051207111320.pmt

I request experts to help me make this file.... Another problem is I don't have any starter help in unix to start with.

Thankx in advance.
Regds.
Srivas.
__________________
duke
Reply With Quote
Forum Sponsor
  #2  
Old 12-07-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Here is a script that will do what you require.

But, the logic in it is based on the data you have provided.

Code:
[@~/temp]$ cat vasan.ksh 
#! /bin/ksh
[[ $# -eq 0 ]] && echo " Need an input" && exit 1
FILE="$@"
[[ -f $FILE ]] && echo "$FILE not available" && exit 1

# FILE could look like
# FILE="/sapdata/deubank/dbdirect/out/deu01deupe/in/deu01deupe20051207111320.pmt"

# ROOT_DIR="/sapdata/deubank/dbdirect/out/deu01deupe"
ROOT_DIR=${FILE%/in/*}

# ROOT_OUT="/sapdata/deubank/dbdirect/out/deu01deupe/out"
ROOT_OUT="$ROOT_DIR/out"

# ROOT_chk="/sapdata/deubank/dbdirect/out/deu01deupe/chk"
ROOT_CHK="$ROOT_DIR/chk"

mkdir "$ROOT_OUT"
mkdir "$ROOT_CHK"

cp "$FILE" "$ROOT_OUT"
cp "$FILE" "$ROOT_CHK/chk$FILE"
Not tested.
Reply With Quote
  #3  
Old 12-07-2005
Registered User
 

Join Date: Sep 2001
Location: Mumbai
Posts: 3
Thankx Mr. Vino .

Regds.
Srini
__________________
duke
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0