![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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"
|
|
#3
|
|||
|
|||
|
Thankx Mr. Vino .
Regds. Srini
__________________
duke |
|||
| Google The UNIX and Linux Forums |