![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| make directory script | malaysoul | Shell Programming and Scripting | 0 | 02-11-2007 11:10 AM |
| Help make script much easier | GCTEII | Shell Programming and Scripting | 2 | 03-18-2006 10:12 AM |
| make my script wait | Blip | Shell Programming and Scripting | 4 | 01-23-2004 12:30 PM |
| make and make install commands | gerwhelan | UNIX for Dummies Questions & Answers | 4 | 07-03-2003 06:49 AM |
| make script | cherio | High Level Programming | 3 | 11-11-2002 10:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to make a script out of commands
Hi,
I have a very basic knowledge of Unix and I need your help for a small script that will do the following commands that I do manually by just giving the filename TPR20080414.txt Code:
cut -d'|' -f3,4 TPR20080414.txt> oe_012.lkp
awk -F "|" '{temp=$1;$1=$2;$2=temp}1' OFS="|" oe_012.lkp > oe_013.lkp
unix2dos oe_012.lkp
unix2dos oe_013.lkp
|
|
||||
|
Code:
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Use as: $0 filename" >&2
exit 1
fi
cut -d'|' -f3,4 ${1} > oe_012.lkp
awk -F "|" '{temp=$1;$1=$2;$2=temp}1' OFS="|" oe_012.lkp > oe_013.lkp
unix2dos oe_012.lkp 2>/dev/null
unix2dos oe_013.lkp 2>/dev/null
|
|
||||
|
Works great!
How I can add as first lines AAADATE20080528|IZA in the oe_012.lkp and IZA|AAADATE20080528 in the oe_13.lkp where 20080528 is the system date in this form? Is it possible to put this script in a central place in a server and then everybody can run by just typing script.sh??? What changed should I make? |
![]() |
| Bookmarks |
| Tags |
| unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|