Sponsored Content
Full Discussion: unix awk scripting
Top Forums Shell Programming and Scripting unix awk scripting Post 302168622 by shaik on Tuesday 19th of February 2008 02:33:09 AM
Old 02-19-2008
Error need more suggestions

well it would be bit difficult to satisfy a requirement which requires something like this

#!/bin/sh

//iam reading the data for amounts from database

AMT[]=`sqlplus -s usrname/pswd <<EOD
set pagesize 0 feedback off verify off heading off echo on
select amount from tablename where condition;
EOD`

//writing to a file created at a specifed direcotry using a awk program

echo "$AMT[]" $noofrec | awk '
BEGIN
{
new=$1;
------------------------------------------------------------------
//i need to write the contents of the array in the file (which is created
at a specified location) in a loop that prints in each line contents of amount AMT[] array(as long as elements are there).

------------------------------------------------------------------
hence my problem is to print the elements in the array one by one in lines which are equivalent to no of elements in the array.

for i furthur read this file for processing

Iam able to get the contents into the array from db but couldnt print it in the file

please need suggestions asap.

Regards
Mahima
--------------------------------------------------------------------

printf "006%d" ,new; //this works fine with 2nd argumnet but dont know how
printf the arrays values?
}

{
printf "%d" ,AMT???
}'END
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

AWK scripting

I have a text file in which the text has been divided into paragraphs (two line breaks or tab marks a new paragraph) and I want to make a script which output would delete line breaks within the paragraph and the different paragraphs would be separated by two line breaks. So, if my input file... (14 Replies)
Discussion started by: Muki101
14 Replies

3. Shell Programming and Scripting

Scripting via awk

Hi, I am trying to understand what is happening here, new to scripting: I have a couple of these, but if I knew what was going on in one I can figure out the rest: awk '/rpc-100083/ { $2 = "enable -r" } $3 ~ /.NOS99dtlogin/ { $t = $2; $2 = $3; $3 = $t } { print }' /var/svc/profile/upgrade... (2 Replies)
Discussion started by: ulemsee
2 Replies

4. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

5. Shell Programming and Scripting

Need help with awk scripting.

Hi, i am newbie to this site and hope to learn but problem is s but need help urgently. Plz pm me if you are good at this. Help will be appreciated. (11 Replies)
Discussion started by: Rookie80
11 Replies

6. Shell Programming and Scripting

Help with AWK and Scripting!

Hi, This is the first time I am working with awk and I am not familiar with any commands in it. But I managed to do most of my work just left with one more. Needing your help! I have to extract only the matrix (written within ) from a text file. For example: 1JTJ_0006_ACGC_NPNP_A_12_15.pdb ... (17 Replies)
Discussion started by: SriJit
17 Replies

7. Shell Programming and Scripting

Need help with awk scripting

hi all, I am working on awk scripting.I have created two awk files and now have a requirement of replacing the contents of first file with some contents of second file. Please find below the two files created.File1 has 3 records and File2 has 4 records. cat File1 111,0165,CB21031251,0165,... (3 Replies)
Discussion started by: csrohit
3 Replies

8. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

9. Shell Programming and Scripting

Need help in awk scripting

Hi I am beginner of shell/AWK scripting , can you please help me in select particular column and column between two pattern from a multiple column file. file1.txt number status date1 date2 description category ... (7 Replies)
Discussion started by: vijay_rajni
7 Replies

10. Shell Programming and Scripting

If else condition inside for loop of awk command in UNIX shell scripting

Hi , Please excuse me for opening a new thread i am unable to find out the syntax error in my if else condition inside for loop in awk command , my actual aim is to print formatted html td tag when if condition (True) having string as "failed", could anyone please advise what is the right... (2 Replies)
Discussion started by: karthikram
2 Replies
amt-howto(7)						 Miscellaneous Information Manual					      amt-howto(7)

NAME
amt-howto - Intel AMT with linux mini howto DESCRIPTION
What is AMT and why I should care? AMT stands for "Active Management Technology". It provides some remote management facilities. They are handled by the hardware and firmware, thus they work independant from the operation system. Means: It works before Linux bootet up to the point where it activated the network interface. It works even when your most recent test kernel deadlocked the machine. Which makes it quite useful for development machines ... Intel AMT is part of the vPro Platform. Recent intel-chipset based business machines should have it. My fairly new Intel SDV machine has it too. Documentation Look here for documentation beyond this mini howto: http://www.intel.com/technology/platform-technology/intel-amt/ Most useful to get started: "Intel AMT Deployment and Reference Guide" Very short AMT enabling instructions. Enter BIOS Setup. * Enable AMT Enter ME (Management Extention) Setup. Ctrl-P hotkey works for me. * Login, factory default password is "admin". * Change password. Trivial ones don't work, must include upper- and lowercase letters, digits, special characters. * Enable AMT Managment. Reboot, Enter ME Setup again with AMT enabled. * Configure AMT (hostname, network config, ...) * Use SMB (Small Business) management mode. The other one (Enterprise) requires Active Directory Service Infrastructure, you don't want that, at least not for your first steps ... Testing AMT Take your browser, point it to http://machine:16992/. If you configured AMT to use DHCP (which is the default) the OS and the management stack share the same IP address. You must do that from a remote host as the NIC intercepts network packets for AMT, thus it doesn't work from the local machine as the pack- ets never pass the NIC then. If everything is fine you'll see a greeting page with a button for login. You can login now, using "admin" as username and the password configured during setup. You'll see some pages with informations about the machine. You can also change AMT settings here. Control Machine You might have noticed already while browing the pages: There is a "Remote Control" page. You can remotely reset and powercycle the machine there, thus recover the machine after booting a b0rken kernel, without having someone walk over to the machine and hit the reset button. Serial-over-LAN (SOL) console AMT also provides a virtual serial port which can be accessed via network. That gives you a serial console without a serial cable to another machine. If you have activated AMT and SOL the linux kernel should see an additional serial port, like this on my machine: [root@xeni ~]# dmesg | grep ttyS2 0000:00:03.3: ttyS2 at I/O 0xe000 (irq = 169) is a 16550A Edit initab, add a line like this: T2:2345:respawn:/sbin/getty ttyS2 115200 vt100-nav You should add the serial port to /etc/securetty too so you are able to login as root. Reload inittab ("init q"). Use amtterm to connect. Tap enter. You should see a login prompt now and be able to login. You can also use that device as console for the linux kernel, using the usual "console=ttyS2,115200" kernel command line argument, so you see the boot messages (and kernel Oopses, if any). You can tell grub to use that serial device, so you can pick a working kernel for the next boot. Usual commands from the grub manual, except that you need "--port=0xe000" instead of "--unit=0" due to the non-standard I/O port for the serial line (my machine, yours might use another port, check linux kernel boot messages). The magic command for the Xen kernel is "com1=115200,8n1,0xe000,0" (again, you might have to replace the I/O port). The final '0' disables the IRQ, otherwise the Xen kernel hangs at boot after enabling interrupts. Fun with Xen and AMT The AMT network stack seems to become slightly confused when running on a Xen host in DHCP mode. Everything works fine as long as only Dom0 runs. But if one starts a guest OS (with bridged networking) AMT suddenly changes the IP address to the one the guest aquired via DHCP. It is probably a good idea to assign a separate static IP address to AMT then. I didn't manage to switch my machine from DHCP to static IP yet though, the BIOS refuses to accept the settings. The error message doesn't indicate why. More fun with AMT You might want to download the DTK (Developer Toolkit, source code is available too) and play with it. The .exe is a self-extracting rar archive and can be unpacked on linux using the unrar utility. The Switchbox comes with a linux binary (additionally to the Windows stuff). The GUI tools are written in C#. Trying to make them fly with mono didn't work for me though (mono version 1.2.3 as shipped with Fedora 7). SEE ALSO
amtterm(1), gamt(1), amttool(1) http://www.intel.com/technology/platform-technology/intel-amt/ WRITTEN BY
Gerd Hoffmann <kraxel@redhat.com> (c) 2007 Gerd Hoffmann amt-howto(7)
All times are GMT -4. The time now is 02:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy