declaring array and move to next line in shell script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting declaring array and move to next line in shell script
# 1  
Old 09-11-2009
declaring array and move to next line in shell script


In shell script, I have a value and i like to move that value to a particular position in a file.

For example, if i have 20000909 then i like to move that to the 15 to 23
position in a file.

Is it possible to have array kind of thing in the shell ?
a[10] is array then
a[0-3] = 123
a[4-7] = 01239
a[8-10] = 128

how to perform this ?

Also how to move to next line ?

# 2  
Old 09-11-2009
# 3  
Old 09-11-2009

Thanks for the bash arrays link.
Once i wrote the array in the file, i like to move to next line
how will it happen in shell script?

Since the array is in the loop,once first set of info is written during the
next loop, i want to start from the second line. So how i can move it
to next line ?


Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass C shell array to another C shell script(csh) and shell(sh)

Dear Friends, Please help me on this my script name is send.csh In this i have written the statement like this set args = ( city state country price ) I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell or how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies

2. UNIX for Dummies Questions & Answers

PERL: Declaring Array

Is it possible to declare an array in the following way: @tmp = (@f,"String1","String2", "String3",@f); I'm getting the following error message: Array found where operator expected at line 181, near "" (Missing semicolon on previous line?) ---------- Post updated at... (1 Reply)
Discussion started by: WongSifu
1 Replies

3. Shell Programming and Scripting

Korn shell script to sync/move files that are not in use

Hello all. This may seem like a dumb/easy question but right now I have a little script I made that uses rsync to sync a directory that has files in it that may or may not be complete files. I want to come up with a better solution for this. What it is is I have a directory lets say /incomplete... (4 Replies)
Discussion started by: linuxn00b
4 Replies

4. Shell Programming and Scripting

Need shell script to move files

Hi , I need a simple shell script to move the files from one directory to another directory after every 1 hour..!!! ?? (1 Reply)
Discussion started by: SARAL SAXENA
1 Replies

5. Shell Programming and Scripting

Need a help to move control to another line in my script

I have menu option in my script and in that i have 4 options like below :- echo "Please select a target server .." echo " AIX - AIX1" echo " AIX - AIX2" echo " AIX - AIX3" echo " HP-UX - HP-UX1" echo "Enter your menu choice : \n" read tgtser ... (8 Replies)
Discussion started by: Renjesh
8 Replies

6. Shell Programming and Scripting

Move shell script from foreground to background

Hi, Need an urgent help. I have a program executing in foreground. I need to execute it in background and also to remove terminal dependency. Thanks In advance. 116@434 (7 Replies)
Discussion started by: 116@434
7 Replies

7. Shell Programming and Scripting

awk script to move a line after the matched pattern line

I have the following text format in a file which lists the question first and then 5 choices after that the explanantion and finally the answer. 1.The amount of time it takes for most of a worker’s occupational knowledge and skills to become obsolete has been declining because of the... (2 Replies)
Discussion started by: nanchil_guy
2 Replies

8. Shell Programming and Scripting

Shell script to move files to 3 different folders

Hi guys: I've got this problem, I want to move a bunch of files to 3 different folders, without any specific order, and I'm trying to automatize it with a shell script. I'm a newbie at shell scripting so this is my first try: #!/bin/bash COUNTER=`ls -1 | wc -l` while do ARRAY=(... (11 Replies)
Discussion started by: wretchedmike
11 Replies

9. Shell Programming and Scripting

Shell script to move certain files on scheduled time

Hi Friends, I want a shell script which will move certain .jar files from a specified location (say /publish/content) to (/publish/archive) on every saturday morning 6 am. One more thing to add is that before moving files it must check free space at (/publish/archive), if it is more than 60 %... (7 Replies)
Discussion started by: abhishek27
7 Replies

10. Shell Programming and Scripting

Script to move the first line of a file to the end

I'm rather new to scripting, and despite my attempts at finding/writing a script to do what I need, I have not yet been successful. I have a file named "list.txt" of arbitrary length with contents in the following format: /home/user/Music/file1.mp3 /home/user/Music/file2.mp3... (21 Replies)
Discussion started by: Altay_H
21 Replies
Login or Register to Ask a Question