Unix/Linux Go Back    


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

Homework & Coursework Questions


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 2 Weeks Ago   -   Original Discussion by gianvitolinuxs
gianvitolinuxs's Unix or Linux Image
gianvitolinuxs gianvitolinuxs is offline
Registered User
 
Join Date: Jan 2018
Last Activity: 7 January 2018, 5:57 PM EST
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 Unix and Linux 2 Weeks Ago   -   Original Discussion by gianvitolinuxs
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 22 January 2018, 11:34 PM EST
Location: Amsterdam
Posts: 11,713
Thanks: 532
Thanked 3,402 Times in 2,997 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
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 2 Weeks Ago 05:07 PM
Script to parse bookmarks file ozgadgetguy Shell Programming and Scripting 4 03-28-2014 03:55 AM
AWK script to parse a data in a file dd_psg Shell Programming and Scripting 6 07-20-2012 08:33 AM
script to parse the properties file prashdeep Shell Programming and Scripting 2 01-23-2012 04:11 AM
Script to parse a file faster sags007_99 Shell Programming and Scripting 7 08-31-2011 03:55 AM



All times are GMT -4. The time now is 11:54 AM.