Script parse file Linux

Hi all, I need help for a script that pulls out a series of numbers from a file (attached file) Basically I need a parse to write me in a variable: 9d424312 Can someone help me? Thank you

1 Like

Hi gianvitolinuxs,
Welcome to the UNIX & Linux Forums.

Is this a homework assignment? Homework and coursework questions can only be posted in the Homework and Coursework Questions forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

If you did not post homework, please explain the company you work for and the nature of the problem you are working on and give us a lot more information so we can figure out how to help you.

  1. What variable do you want to set? In what language will this variable be used? (Such as a Bourne shell compatible shell, a csh compatible shell, awk , perl , C , etc.)
  2. Which Linux operating system are you using?
  3. What shell are you using?
  4. Is the value to be assigned to your variable the constant 9d424312 you specified in post #1? If not, how is your script supposed to determine that it has found the value that you want to assign to your variable from your file?
  5. What is the name of your file? In what directory will that file be found?
  6. What have you tried to solve this problem on your own?
1 Like
grep "(NFCID1):" aid.conf | sed 's/.*://; s/ //g' | read var
sed -n '/(NFCID1):/{s/.*://; s/ //g;p}' aid.conf | read var
awk '$0 ~ /NFCID1/ {sub(".*:", ""); gsub(" ", ""); print}' aid.conf | read var
1 Like