Homework & Coursework Questions

Students must use and complete the template provided. If you do not use the template your post may be deleted! Special homework rules apply here.

Script parse file

👤 Login to reply

    #1  
Old 01-06-2018
gianvitolinuxs gianvitolinuxs is offline
Registered User
 
Join Date: Jan 2018
Last Activity: 28 May 2018, 1:24 PM EDT
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Script parse file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

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 file and write only in a generic variable (serial) : 9d424312

2. Relevant commands, code, scripts, algorithms:
unix shell scripting


3. The attempts at a solution (include all code and scripts):

Code:
{ s=$(<aid.conf);} 2>/dev/null while IFS= read str ; do               IFS= read -ra ADDR <<< "$str"    for i in "${ADDR[@]}"; do        echo $i    done    done <<< "$s"

Linux Debian 9.3
nome script: try.sh

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

homework project (read tag NFC)
Sponsored Links
    #2  
Old 01-06-2018
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 20 July 2018, 5:53 PM EDT
Location: Amsterdam
Posts: 11,853
Thanks: 546
Thanked 3,469 Times in 3,057 Posts
Hi there is not input file specified. Please post a relevant sample.

That being said,
Code:
IFS= read -ra ADDR <<< "$str"

means that there is always exactly one array element in array ADDR, since you set the field separator to the empty string.
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script parse file Linux gianvitolinuxs Shell Programming and Scripting 2 01-05-2018 04:07 PM
Script to parse bookmarks file ozgadgetguy Shell Programming and Scripting 4 03-28-2014 02:55 AM
AWK script to parse a data in a file dd_psg Shell Programming and Scripting 6 07-20-2012 07:33 AM
script to parse the properties file prashdeep Shell Programming and Scripting 2 01-23-2012 03:11 AM
Script to parse a file faster sags007_99 Shell Programming and Scripting 7 08-31-2011 02:55 AM



All times are GMT -4. The time now is 08:50 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?