Sponsored Content
Full Discussion: Help with scripting
Top Forums Shell Programming and Scripting Help with scripting Post 302194136 by Northerner on Monday 12th of May 2008 09:43:29 AM
Old 05-12-2008
Having tested this on the simple files I provided it appears it doesn't work on the more complexed files. The first file has 6 field separated by blanks

File1

LVTS4687 LVTSHPLON ltreb_shu1l110 LVTS4687 LVTSHPLON shu1l110
LVTS1457 LVTSHP sy_unix_live_rooma_onsite_35_35 LVTS1457 LVTSHP syhp10
LVTS5035 LVTSHP sy_unix_live_dmz_duplex_15_35 LVTS5035 LVTSHP srublae03-mgt
LVTS1786 LVTSHPLON lmurb_shu1l282 LVTS1786 LVTSHPLON shu1l282-sy
LVTS5431 LVTSHPLON lmurb_shu1l282 LVTS5431 LVTSHPLON shu1l282-sy
LVTS5750 LVTSHP nw_unix_live_dmz_duplex_35_35 LVTS5750 LVTSHP NRUCCAE09-MGT
LVTS5430 LVTSHP nw_unix_live_dmz_duplex_15_35 LVTS5430 LVTSHP nwhp3
LVTS4021 LVTSHP nw_unix_live_phase4_duplex_35_90 LVTS4021 LVTSHP nhu1u282

The second file has 5 fields
File 2
0508 0601 LVTS4687 58 1
0509 0108 LVTS4687 58 1
0509 0108 LVTS4687 58 1
0509 0108 LVTS4687 58 1
0508 2206 LVTS5035 98 1
0508 2206 LVTS5035 98 1
0508 2206 LVTS5035 98 1
0508 2206 LVTS5430 98 1
0508 2206 LVTS5430 98 1
0508 2206 LVTS5430 98 1
0508 2206 LVTS5431 98 1
0508 2206 LVTS5431 98 1
0508 2206 LVTS5431 98 1
0506 0920 LVTS5750 141 3
0506 0920 LVTS5750 141 3
0506 0920 LVTS5750 141 3
0506 0920 LVTS5750 141 3
0506 0920 LVTS5750 141 3
0506 0920 LVTS5750 141 3


and the result would need to look like

File3
0508 0601 LVTS4687 58 1 ltreb_shu1l110 shu1l110
0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110
0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110
0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110
0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt
0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt
0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt
0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3
0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3
0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3
0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy
0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy
0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT
0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT


this file comprises of field 1 2 3 4 5 of file2 and field 3 and 6 of file1
 

10 More Discussions You Might Find Interesting

1. AIX

New to scripting

We have a scripting requirement, Background: On a particular path, we compress a load of log files into tar.gz. This is done on an hourly basis throughout the day and it produces files of the following format, 2005-08-05-00-021031.tar.gz as an example. This is done by a script. We need: ... (2 Replies)
Discussion started by: rajesh_149
2 Replies

2. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies

3. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

4. UNIX for Advanced & Expert Users

Need help on scripting

in unix bc command is used as calculator and also for conversion, i want to convert 5f to decimal. but bc dont consider 5f as hex value it considers 5F as hex value. I get 5f from other iteration so i cant change that f to F...is there any way to convert 5f to decimal ot 5f to 5F :rolleyes: (2 Replies)
Discussion started by: abhinandantn
2 Replies

5. UNIX for Dummies Questions & Answers

Scripting Help

Hello all. Like Ive stated before, I am new to world of Unix. I was given the tast to create a script that will concatenate 20 files into one file. I know that the cat command is to be used but I am looking for something to get started on. Again, basically I need to wrtie a script that whill... (3 Replies)
Discussion started by: ndoggy020
3 Replies

6. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

7. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

8. Android

Android Scripting Environment: Shell Scripting and Android

I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Discussion started by: Neo
0 Replies

9. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

10. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies
LKSH(1) 						    BSD General Commands Manual 						   LKSH(1)

NAME
lksh -- Legacy Korn shell built on mksh SYNOPSIS
lksh [-+abCefhiklmnprUuvXx] [-+o opt] [-c string | -s | file [args ...]] DESCRIPTION
lksh is a command interpreter intended exclusively for running legacy shell scripts. It is built on mksh; refer to its manual page for details on the scripting language. It is recommended to port scripts to mksh instead of relying on legacy or idiotic POSIX-mandated behav- iour, since the MirBSD Korn Shell scripting language is much more consistent. LEGACY MODE
lksh has the following differences from mksh: o lksh is not suitable for use as /bin/sh. o There is no explicit support for interactive use, nor any command line editing or history code. Hence, lksh is not suitable as a user's login shell, either; use mksh instead. o The KSH_VERSION string identifies lksh as ``LEGACY KSH'' instead of ``MIRBSD KSH''. o lksh only offers the traditional ten file descriptors to scripts. o lksh uses POSIX arithmetics, which has quite a few implications: The data type for arithmetics is the host ISO C long data type. Signed integer wraparound is Undefined Behaviour. The sign of the result of a modulo operation with at least one negative operand is unspeci- fied. Shift operations on negative numbers are unspecified. Division of the largest negative number by -1 is Undefined Behaviour. The compiler is permitted to delete all data and crash the system if Undefined Behaviour occurs. o The rotation arithmetic operators are not available. o The shift arithmetic operators take all bits of the second operand into account; if they exceed permitted precision, the result is unspecified. o The GNU bash extension &> to redirect stdout and stderr in one go is not parsed. o The mksh command line option -T is not available. o Unless set -o posix is active, lksh always uses traditional mode for constructs like: $ set -- $(getopt ab:c "$@") $ echo $? POSIX mandates this to show 0, but traditional mode passes through the errorlevel from the getopt(1) command. o lksh, unlike AT&T UNIX ksh, does not keep file descriptors > 2 private. SEE ALSO
mksh(1) https://www.mirbsd.org/mksh.htm https://www.mirbsd.org/ksh-chan.htm CAVEATS
lksh tries to make a cross between a legacy bourne/posix compatibl-ish shell and a legacy pdksh-alike but ``legacy'' is not exactly speci- fied. The set built-in command does not have all options one would expect from a full-blown mksh or pdksh. Talk to the MirOS development team using the mailing list at <miros-mksh@mirbsd.org> or the #!/bin/mksh (or #ksh) IRC channel at irc.freenode.net (Port 6697 SSL, 6667 unencrypted) if you need any further quirks or assistance, and consider migrating your legacy scripts to work with mksh instead of requiring lksh. MirBSD May 2, 2013 MirBSD
All times are GMT -4. The time now is 07:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy