Sponsored Content
Full Discussion: Looping
Top Forums Shell Programming and Scripting Looping Post 302521382 by Skrynesaver on Wednesday 11th of May 2011 05:51:24 AM
Old 05-11-2011
Quote:
Originally Posted by Aditya.Gurgaon
sed 's/accelerate/acceler/g' inputfile
by this i can get value "acceler" in 1st loop but in 2nd loop i wantreverse
So you need to check the current state and act differently depending on the current state
Code:
if accelerate=$(grep accelerate inputfile); then 
   sed 's/accelerate/acceler/g' inputfile
else
   sed 's/acceler/accelerate/g' inputfile
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with looping

Hi, Actually I have a file which consists data . for eg names. Then I want my sql query to read this file and produce the output. Currently I am using this FOR EG : FILENAME is NAMES for i in `cat NAMES` { sqlplus -s $CONNECTID << EOF spool rooh set heading off select... (1 Reply)
Discussion started by: rooh
1 Replies

2. Shell Programming and Scripting

looping

Hi I have around 100 users in sun server and have default home directory in /usr/home/<username> I want to clean their home directory time to time to make free space on root, as users generate many output files during usage of application. My idea is, generate a file with following command... (4 Replies)
Discussion started by: ishir
4 Replies

3. Shell Programming and Scripting

Looping through the directory

Hi, I have to write a KSH script to loop through the directory and transfer all the files through FTP. The source machine is the Network shared drive and the files in the directory needs to be FTPied to the UNIX server. For eg. Directory (Datasource) + Directory1 ... (6 Replies)
Discussion started by: mahalakshmi
6 Replies

4. Shell Programming and Scripting

for looping

I run into a issue when I try to do sorting of the following with ascending order, one round of for looping seems not working, anyone knows how to use shell or perl? $array = (5,0,3,2,7,9,8) (2 Replies)
Discussion started by: ccp
2 Replies

5. Shell Programming and Scripting

help on looping using if/for or while

Hello, where can I get usefull information on the use of looping with for , if and while with extensive examples. Also use of variables in scripts (1 Reply)
Discussion started by: sam4now
1 Replies

6. Shell Programming and Scripting

help with looping

vesselNames values: xxx yyy zzz vesselPlanned values: xxx zzz zzz zzz OIFS="" OIFS=$IFS IFS="\n" (2 Replies)
Discussion started by: finalight
2 Replies

7. Shell Programming and Scripting

Looping through entries

Hi everyone, I am having trouble looping through entries in a file. The file several entries that are separated by topics e.g. <Topic r:id="Top/World/Français"> </Topic> <Topic r:id="Top/World/Français/Actualité"> </Topic> <Topic r:id="Top/World/Français/Actualité/A_la_Une"> <link... (1 Reply)
Discussion started by: BlueberryPickle
1 Replies

8. Shell Programming and Scripting

Looping

Hi, Now I have written a script which sorts the records in the file and splits them according to some condition. Now, I need to modify the script so that it reads all the files one after the other and does the sorting & splitting. Pls help me in reading all the files in a directory and... (8 Replies)
Discussion started by: Sunitha_edi82
8 Replies

9. Shell Programming and Scripting

looping while using getopts

so when i use rm file -i vv bb i can delete the first file vv but i cant seem to delete the second file bb as i tried to use shift on it, but it seems that it delete the first one and stops it without looping it to the next file. what is wrong with my coding ? #!/bin/bash function... (3 Replies)
Discussion started by: cman123
3 Replies

10. Shell Programming and Scripting

Looping

Hey guys, so I am trying to do a loop script that will go through each folder (no gui so just each domain has a folder) and grab out the databases being used on that domain. I know I would use mysql -e "show databases where not 'information_schema';" once in each directory to pull the actual... (3 Replies)
Discussion started by: dough
3 Replies
FDWRITE(1)						    BSD General Commands Manual 						FDWRITE(1)

NAME
fdwrite -- format and write floppy disks SYNOPSIS
fdwrite [-v] [-y] [-f inputfile] [-d device] DESCRIPTION
The fdwrite utility formats and writes one and more floppy disks. Any floppy disk device capable of formatting can be used. The fdwrite utility will ask the user (on /dev/tty) to insert a new floppy and press return. The device will then be opened, and queried for its parameters, then each track will be formatted, written with data from the inputfile, read back and compared. When the floppy disk is filled, the process is repeated, with the next disk. This continues until the program is interrupted or EOF is encountered on the inputfile. The options are as follows: -v Toggle verbosity on stdout. Default is ``on''. After device is opened first time the format will be printed. During operation progress will be reported with the number of tracks remaining on the current floppy disk, and the letters I, Z, F, W, R and C, which indicates completion of Input, Zero-fill, Format Write, Read and Compare of current track respec- tively. -y Do not ask for presence of a floppy disk in the drive. This non-interactive flag is useful for shell scripts. -f inputfile Input file to read. If none is given, stdin is assumed. -d device The name of the floppy device to write to. Default is /dev/fd0. The fdwrite utility actually closes the device while it waits for the user to press return, it is thus quite possible to use the drive for other purposes at this time and later resume writing with the next floppy. The parameters returned from device are used for formatting. If custom formatting is needed, please use fdformat(1) instead. EXAMPLES
The fdwrite utility was planned as a tool to make life easier when writing a set of floppies, one such use could be to write a tar-archive: tar cf -. | gzip -9 | fdwrite -d /dev/fd0.1720 -v The main difference from using tar(1)'s multivolume facility is of course the formatting of the floppies, which here is done on the fly, thus reducing the amount of work for the floppy-jockey. SEE ALSO
fdformat(1) HISTORY
The fdwrite utility was written while waiting for ``make world'' to complete. Some of the code was taken from fdformat(1). AUTHORS
The program has been contributed by Poul-Henning Kamp <phk@FreeBSD.org>. BUGS
Diagnostics are less than complete at present. If a floppy is sick, and the inputfile is seekable, it should ask the user to frisbee the disk, insert another, and rewind to the right spot and continue. This concept could be extended to cover non-seekable input also by employing a temporary file. An option (defaulting to zero) should allow the user to ask for retries in case of failure. At present a suitable tool for reading back a multivolume set of floppies is missing. Programs like tar(1) for instance, will do the job, if the data has not been compressed. One can always trust dd(1) to help out in this situation of course. BSD
September 16, 1993 BSD
All times are GMT -4. The time now is 02:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy