Hallo,
I've the Problem to substitute a awk-scribt with a shell script.( On my AIX-Systems I've only the old version of awk, no nawk).
I have a file like this:
///MIF-File
Start Component
Name = "My Workstation Template"
Description = "Sample MIF Template"
Start Group
Name = "PC Information"
Id = 1
Class = "AMO|PC Information|1.0"
Start Attribute
Name = "Start Component
Name = "My Workstation Template"
Description = "Sample MIF Template"
Start Group
Name = "PC Information"
Id = 1
Class = "AMO|PC Information|1.0"
Start Attribute
Name = "Inventar Number"
Id = 1
Storage = Specific
Type = String(32)
Access = Write-Only
Value = "I798xxxxxx"
End Attribute"
Id = 1
Storage = Specific
Type = String(32)
Access = Write-Only
Value = "I798xxxxxx"
End Attribute
///END MIF-File
I want to print the Value for "Name" and "Value" after line 13 with the possibility to change "Value".
Here's the awk-Script:
#! /bin/nawk -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 < "/dev/fd/0"
name = " Value = \"" x"\""
}
}
{print name >> out
}
Now I'm looking since 2 days for a way to do this in a shell-Script. All i have to read the file line by line but i have no idea for the if-clause.
Thank you and reguards
I've the Problem to substitute a awk-scribt with a shell script.( On my AIX-Systems I've only the old version of awk, no nawk).
I have a file like this:
///MIF-File
Start Component
Name = "My Workstation Template"
Description = "Sample MIF Template"
Start Group
Name = "PC Information"
Id = 1
Class = "AMO|PC Information|1.0"
Start Attribute
Name = "Start Component
Name = "My Workstation Template"
Description = "Sample MIF Template"
Start Group
Name = "PC Information"
Id = 1
Class = "AMO|PC Information|1.0"
Start Attribute
Name = "Inventar Number"
Id = 1
Storage = Specific
Type = String(32)
Access = Write-Only
Value = "I798xxxxxx"
End Attribute"
Id = 1
Storage = Specific
Type = String(32)
Access = Write-Only
Value = "I798xxxxxx"
End Attribute
///END MIF-File
I want to print the Value for "Name" and "Value" after line 13 with the possibility to change "Value".
Here's the awk-Script:
#! /bin/nawk -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 < "/dev/fd/0"
name = " Value = \"" x"\""
}
}
{print name >> out
}
Now I'm looking since 2 days for a way to do this in a shell-Script. All i have to read the file line by line but i have no idea for the if-clause.
Thank you and reguards