LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-01-2014, 05:19 AM   #16
srinureddy
LQ Newbie
 
Registered: Oct 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
Sorry guys....


i am real trying this...
my code is:

echo "enter file name:"
read fname
if [ -f $fname ]
then
set declare -a ar
IFS=","
n=0
while read f
do
set -- $f
while [ "$#" -gt 0 ]
do
ar[$n]="$1"
n=$((n+1))
shift
done
echo "==================="
done<$fname
else
echo "file not found"
fi


output is:

test.csv
./co.sh: line 21: ar[0]="101": not found
./co.sh: line 21: ar[1]="manju": not found
./co.sh: line 21: ar[2]="sdgsg": not found
===================
./co.sh: line 21: ar[3]="102": not found
./co.sh: line 21: ar[4]="dipti": not found
./co.sh: line 21: ar[5]="gsdga: not found
./co.sh: line 21: ar[6]=dfgs": not found
===================
./co.sh: line 21: ar[7]="103": not found
./co.sh: line 21: ar[8]="sushma": not found
./co.sh: line 21: ar[9]="dfsdfs"sdfs": not found
===================
./co.sh: line 21: ar[10]="104": not found
./co.sh: line 21: ar[11]="bhagi": not found
./co.sh: line 21: ar[12]="dfjsv sddfsd": not found
===================
/var/root #

pl z help me....
 
Old 11-01-2014, 07:54 AM   #17
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,329

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by srinureddy View Post
i am real trying this...
my code is:
…not in code tags, as you've been asked to several times. And this is the FIRST bit you posted in any of your threads
Quote:
output is:

test.csv
./co.sh: line 21: ar[0]="101": not found
./co.sh: line 21: ar[1]="manju": not found
./co.sh: line 21: ar[2]="sdgsg": not found
===================
./co.sh: line 21: ar[3]="102": not found
./co.sh: line 21: ar[4]="dipti": not found
./co.sh: line 21: ar[5]="gsdga: not found
./co.sh: line 21: ar[6]=dfgs": not found
===================
./co.sh: line 21: ar[7]="103": not found
./co.sh: line 21: ar[8]="sushma": not found
./co.sh: line 21: ar[9]="dfsdfs"sdfs": not found
===================
./co.sh: line 21: ar[10]="104": not found
./co.sh: line 21: ar[11]="bhagi": not found
./co.sh: line 21: ar[12]="dfjsv sddfsd": not found
===================
/var/root #

pl z help me....
AGAIN: Spell out your words and quit using text speak, and read the LQ Rules. You posted the same question several times, and keep using text speak.

Your program very clearly has an error on line 21 Have you looked at it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] changing row data files into column data files tabbygirl1990 Linux - Newbie 18 01-29-2014 10:33 AM
[SOLVED] HELP! How to merge two files as column wise?? SAAAD Linux - Newbie 9 03-24-2013 02:31 AM
How to read CSV data and compare the column values and then write them in new file VijayaRaghavanLakshman Linux - Newbie 9 01-26-2012 10:02 PM
awk - rearrange column data in csv file to match columns wolverene13 Programming 9 12-21-2011 05:55 AM
printing column wise bharatbsharma Programming 4 09-11-2008 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration