Open txt and store line in a var


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Open txt and store line in a var
# 8  
Old 01-08-2009
Code:
$ cat ./fill_array.ksh
#!/bin/ksh

ARRAYIDX=0
grep lib /home/ruben/Desktop/rsyncbackup/2tuesday/diff.txt|cut -d':' -f2|grep '/'|while read LINE
do
   ARRAY[ARRAYIDX]=$LINE
   print "ARRAY($ARRAYIDX)=${ARRAY[ARRAYIDX]}"
   ARRAYIDX=$(($ARRAYIDX+1))
done

exit 0

$ ./fill_array.ksh
ARRAY(0)=lib32/jniwrap.lic
ARRAY(1)=lib32/ruben file
ARRAY(2)=lib32/ruben file 2
ARRAY(3)=lib32/ruben file 2~

# 9  
Old 01-08-2009
can I use #!/bin/sh instead of #!/bin/ksh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to store info from a txt file into a hash?

I'm trying to make a perl script using the "open" command to open and read a file, storing the information in said file into a hash structure. This is what is inside my file- Celena Standard F 01/24/94 Cancer Jeniffer Orlowski F 06/24/86 None Brent Koehler M 12/05/97 HIV Mao Schleich... (4 Replies)
Discussion started by: Eric1
4 Replies

2. Shell Programming and Scripting

Vim help.txt automatically open every time I open vi

Hi Friends, Every I try to open a vi window, vim help.txt automatically opens evertime. After doing ZZ or :q! also the same page opens automatically. How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue. Thanks... (3 Replies)
Discussion started by: sudiptabhaskar
3 Replies

3. UNIX for Beginners Questions & Answers

Vim help.txt automatically open every time I open vi

Hi Friends, Every I try to open a vi window vim help.txt automatically opens evertime. After doing ZZ or :q! also the same page opens automatically. How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue. Thanks... (1 Reply)
Discussion started by: sudiptabhaskar
1 Replies

4. UNIX for Dummies Questions & Answers

Split Every Line In Txt Into Separate Txt File, Named Same As The Line

Hi All Is there a way to export every line into new txt file where by the title of each txt output are same as the line ? I have this txt files containing names: Kandra Vanhooser Rhona Menefee Reynaldo Hutt Houston Rafferty Charmaine Lord Albertine Poucher Juana Maes Mitch Lobel... (2 Replies)
Discussion started by: Nexeu
2 Replies

5. Solaris

Configuring 'auditd' service to not store the audit logs in /var partition

Hello all, I've configured 'audit' service to send the audit logs to a remote log server (by using syslog plugin), which is working fine. However, there is a problem. audit service also tries to write same information (but in binary format) in /var/audit path. So, Is there anyway to stop... (2 Replies)
Discussion started by: Anti_Evil
2 Replies

6. Shell Programming and Scripting

Need to append the date | abcddate.txt to the first line of my txt file

I want to add/append the info in the following format to my.txt file. 20130702|abcd20130702.txt FN|SN|DOB I tried the below script but it throws me some exceptions. <#!/bin/sh dt = date '+%y%m%d'members; echo $dt+|+members+$dt; /usr/bin/awk -f BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Discussion started by: harik1982
6 Replies

7. Shell Programming and Scripting

Store output of DB Cursor to a txt file

I am writing a cursor to select values from 3 tables. I want to store these values in a txt file which I will be sending via ftp. I am able to store the results of simple select queries to the txt file. but I am not sure how to store the values when using a cursor. I have given the sql query below.... (1 Reply)
Discussion started by: naveensraj
1 Replies

8. Shell Programming and Scripting

How to store the sql query output into txt file?

Hi I want ot save SQL query result in one txt file. for that i have written one code line sqlplus -s $dbstring @/usr/local/bin/sched/nightly_Cronjob/exec_123.sql >> /usr/local/bin/sched/nightly_Cronjob/result.txt but it is not working . database : Oracle so please advice me how can i... (7 Replies)
Discussion started by: Himanshu_soni
7 Replies

9. Solaris

unix txt files in M$: /var/adm/messages

hi I have a script that mails me when certain event are logged in /var/adm/messages. When the mail reaches me there are no line breaks (its just one really long line) so I tried piping the output of the script to a text file which I run `unix2dos` on then mail myself that, but that didn't work. ... (2 Replies)
Discussion started by: s1ckle
2 Replies

10. Shell Programming and Scripting

Store command in a Var problem

Hi! I strated to script since 1 month and I don't have much expirience but this thing here is strange I have a script where I want to store a svn command in a var to check it later so it's like this #!/bin/sh list=`ssh itadmin@192.168.1.200 "ls /home/svn"` # this stores the list of... (13 Replies)
Discussion started by: ruben.rodrigues
13 Replies
Login or Register to Ask a Question