Shell script to read lines in a text file and filter user data Shell Programming and Scripting

Tags
beginners, shell script, shell script automation runloop, unix

 

 
Thread Tools Search this Thread
# 1  
Old 03-25-2014
Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas

Last edited by VikrantD; 03-25-2014 at 04:35 AM..
# 2  
Old 03-25-2014
Hi what have you tried so far?
# 3  
Old 03-25-2014
Sir, i tried as following way ..
Code:
   #!/bin/bash
    filename="/home/vikrant/study/sample.txt"
    exec<${filename}
    value=0
    declare -a arr
    while read line
    do
    varray=(`echo $line | awk '{ split($0, ulist, "|"); for(i=1; i<=11; i++) printf ulist[i] " "; }'`)
    echo "Array Length: " ${#varray[@]}
    done



buts its not working
actually i m very beginner for shell scripting
still i m trying my best
Moderator's Comments:
Mod Comment select text first before pushing the code tags button

Last edited by Scrutinizer; 03-25-2014 at 02:51 AM..
# 4  
Old 03-25-2014
I am not seeing any relationship between the sample data, the desired output, or sample.txt included in the 1st message in this thread and the shell script shown in the 3rd message in this thread.

I was expecting the sample data shown in the 1st message and the data in sample.txt attached to the 1st message to be the same (or at least similar), but they aren't. I don't see any obvious relationship between the desired output and the sample input or sample.txt data.

Please give us an English description of what the format is for the input data. Then explain why the count shown in the first line does not exactly match the number of characters in the following lines, why some groups start with ength-<number>] while others start with Length-<number>], what determines what should be printed in the 1st two fields of the output, and what determines how much of the text from the input should be copied into the 3rd field in the output.
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Similar Threads More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to get the shell script to read the .txt file as an input/data? Gurdza32 Shell Programming and Scripting 11 05-05-2017 05:12 AM
Read csv file, convert the data and make one text file in UNIX shell scripting RJG Shell Programming and Scripting 6 11-02-2016 09:48 AM
Shell - Read a text file with two words and extract data dandaryll UNIX for Beginners Questions & Answers 5 10-14-2016 10:37 AM
Delete all CONSECUTIVE text lines from file shell scripting RJSKR28 Shell Programming and Scripting 5 07-21-2016 10:43 AM
Need help on inserting data from text file to excel using shell script suman.frnz Shell Programming and Scripting 3 04-24-2013 03:19 AM
How to create a shell script to read a foldername from a text file and go to the folder? pm1504 Shell Programming and Scripting 7 01-28-2013 02:10 AM
Read data from .csv file through shell script & modify raj100 Shell Programming and Scripting 3 03-21-2011 09:32 AM
How to read the data from the text file in shell script? dineshmurs Shell Programming and Scripting 2 04-13-2010 03:41 PM
Filter data in Excel sheet using Shell Script bhanusri83 Shell Programming and Scripting 8 12-14-2009 10:48 PM
Shell script to read lines in a text file and filter user data srimal Shell Programming and Scripting 4 10-23-2009 02:35 AM
Using Shell Script to get data from text file jermaine4ever Shell Programming and Scripting 1 03-13-2009 09:58 PM
shell script to read data from text file and to load it into a table in TOAD pallavishetty Shell Programming and Scripting 1 10-31-2008 05:15 AM
Post Shell programming: Question about source a file and read data from the file ccwq Shell Programming and Scripting 3 08-04-2007 11:28 PM
Shell Script to read specific lines in a file varshanswamy Shell Programming and Scripting 5 08-22-2005 08:12 PM
To Read a text file using shell Programming sandytul UNIX for Dummies Questions & Answers 1 04-11-2001 12:15 PM
All times are GMT -4. The time now is 08:32 AM.

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





Not a Forum Member?
Forgot Password?