Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read from Standard in

Status
Not open for further replies.

lzbsupp1

Programmer
Jun 12, 2003
4
DE
Hallo, I'm new in this form and I',m starting using awk for scripting.

I've a problem with a script within Suse Linux/AIX.

Using the following script to give out Names and according values. It should be possible to change the values and write it back to the outputfile. But on a AIX-System the script doesn't work:

#! /bin/awk -f
BEGIN{
anfang=13
FS = "="
out = "hardwareinfo.mif"
print "" > out
}

{name=$0}
{if (NR>anfang&&$0 ~ /Name/) {
print $2
}
}
{if (NR>anfang&&$0 ~ /Value/) {
print $2"\n\nBitte neuen Wert eingeben"
getline x < &quot;-&quot;
name = &quot; Value = \&quot;&quot; x&quot;\&quot;&quot;
}
}
{print name >> out
}

Any Idea ?

Thanks and reguards
 
How do you run this script?
If its
Code:
awk -f script hardwareinfo.mif
then you're going to be modifying the file as you read it.

> But on a AIX-System the script doesn't work:
But it works on Suse Linux?

> getline x < &quot;-&quot;
It's almost certain that you're using GNU AWK on the Linux box, which has many extensions is recognising this as meaning read from stdin.

Not sure if this would still work on your AIX machine, but you could try
getline x < &quot;/dev/stdin&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top