hello guys,
I have a file like this:
input.dat
Push-to-talk
No
Coonection
IP support
Support for IP telephony
Yes
Built-in SIP stack
Yes
Support via software
Yes
Microsoft
Support for Microsoft Exchange
Yes
UMA
No
Internet
Internet connection
WAP
Yes
Weight
129 g
GUI type
Display
Colour
Number of colours
262144
Display technology
LCD
Display Resolution
Screen resolution
320x480 pixels
Screen size
3.2 inches
Touchscreen
Yes
Simultaneous touch points
3+ Multi-touch
Type of technology
Capacitive
and the feature list is:
featureList.dat
Speaker
Support for IP telephony
Support for Microsoft Exchange
UMA
WAP
Weight
Bluetooth
Dimension
Display technology
Screen resolution
Screen size
Touchscreen
Type of technology
USB connsection
and the desired output is:
output.dat:
null
Yes
Yes
No
Yes
129 g
null
null
LCD
320x480 pixels
3.2 inches
Yes
Capacitive
null
I want to see what are the values of the features in the input file (features have their values in the line below them)
if the feature does not exist then the value would be "null"
there are some features in the input that are not in the featureList.dat, so just the desired features are the subject for the extraction.
I came up to this code by the help of Ahamed, but I have problem with it
awk '{gsub(/[ ]*$/,"")}NR==FNR{x=$0;getline;getline;a[x]=$0;next}{print a[$0]?a[$0]:"null"}' file1 file2