Need an urgent solution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need an urgent solution
# 1  
Old 11-21-2003
Need an urgent solution

Hi guys ,

I think i have completely lost touch with awk ... but now i need it deseparatly ...

my problem is for each line in the line i have to check if the first 2 charactes are 'A4' and if they are 'A4' then cut the characters

from position 11-16 from that line ...

In the meantime i will try to recall my awk concepts .. hate myself
Smilie

Thanks in advance
# 2  
Old 11-21-2003
A few questions:
What does the data look like? How is the file delimited? Are there delimiters or is it one stream of data (No spaces)? I dont write too much awk! Here is a start. ($STRING is your file name!)

echo $STRING | awk '
{
for (i=0; i<=NR; i++)
if (toupper(substr($i,0,2) ) == "A4")
{
#Add stuff here
my_stuff=substr($i,11,5)
print my_stuff >> "awk-log-file.dat"
}
} '

Last edited by google; 11-21-2003 at 02:44 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Shell Programming and Scripting

Urgent solution for simple sed

Hi Im running this command on AIX in ksh. My input file samp1 contains 1 2 123 12345 When I execute the following sed i dont get a matching pattern sed -n '/{1}/p' samp1 Can anyone help me with this simple thing (3 Replies)
Discussion started by: raghav288
3 Replies

3. UNIX for Advanced & Expert Users

URGENT,URGENT- Need help tape drive installation

Hi, I am trying to attach tape drive to sun V890 running Solaris 9 on it. I have installed HBA(qlogic) in slot 1 of 0-8 slots and booted the system. I do not see HBAin prtdiag output. The tape drive is not attached to HBA. The tape drive I am going to attach is Sony AIT3. 1.How can I make... (3 Replies)
Discussion started by: sriny
3 Replies
Login or Register to Ask a Question