Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Looping Logic, Need to implement Post 302848709 by Nsharma3006 on Thursday 29th of August 2013 10:07:45 PM
Old 08-29-2013
Looping Logic, Need to implement

I need to implement a looping logic.

Code:
If [ Test = 1] then
Go to /path1/file*

Get all the filename starting with file* and store it in a array
count file number and store it in variable like run
Ex: I found 3 file with starting file* so my run = 3
means my loop should run three time
May be like this

Code:
While run =3

for first filename, it search 'a' is there in the file if yes
echo ' a is exist'
else
echo 'a is not exist
run ++

so next time it again run and search 'a' in the second file to
echo ' a is exist'
else
echo 'a is not exist
run ++


and same again it search 'a' in the third file.


Kindly help
 

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Logic needed to recursive looping in the script

Hello i have a requirement where in a file i will get string. The length could be from 1 to 20. if the string is less than 6 characters ( ex: ABCD) . i need to append 'X' on right hand side to make it 6 characters (ex: ABCDXX). if suppose i get the same string from the file as ABCDXX then i... (5 Replies)
Discussion started by: dsdev_123
5 Replies

2. Shell Programming and Scripting

Need logic to implement file compare.

Hi all I have a requirement where i have to develop a file compare tool. Requirement: I have one expected file and one actual file. Both the files are database dumps in a csv file comma seperated. The first line of the file has the column names. Now there are 3 scenarios: 1) Firstly we have... (0 Replies)
Discussion started by: Ganesh_more
0 Replies

3. Shell Programming and Scripting

How to implement "not in" logic in UNIX script?

Hi Gurus, I need use "not in " logic in my script, like below if $name not in exception_file_list, then do something. anyone can help out this? Thanks in advance. (5 Replies)
Discussion started by: ken6503
5 Replies

4. Programming

Missing Logic Looping Through Switch Statement

Having trouble with the logic when looping over this switch case again: for (j = 0; data != 0; j++){ switch(data){ case 'c': output = ranit(r_brace_array); break; case 'h': output = ranit(pipe_array); break; ... (6 Replies)
Discussion started by: Azrael
6 Replies
AXI-CACHE(1)							   User Commands						      AXI-CACHE(1)

NAME
axi-cache - query the Apt Xapian Index SYNOPSIS
axi-cache [options] command [args] DESCRIPTION
Query the Apt Xapian index. Commands: search commands: axi-cache again [query] repeat the last search, possibly adding query terms axi-cache help show a summary of commands axi-cache info print information about the apt-xapian-index environment axi-cache last [count] show the last results again axi-cache more [count] show more terms from the last search axi-cache rdetails pkgname[s] show details of reverse relationships for the given packages axi-cache search [terms] start a new search apt-cache front-ends: axi-cache depends pkgname[s] run apt-cache depends pkgname[s] axi-cache madison pkgname[s] run apt-cache madison pkgname[s] axi-cache policy pkgname[s] run apt-cache policy pkgname[s] axi-cache rdepends pkgname[s] run apt-cache rdepends pkgname[s] axi-cache show pkgname[s] run apt-cache show pkgname[s] axi-cache showpkg pkgname[s] run apt-cache showpkg pkgname[s] axi-cache showsrc pkgname[s] run apt-cache showsrc pkgname[s] OPTIONS
--version show program's version number and exit -h, --help show this help message and exit -s SORT, --sort=SORT sort by the given value, as listed in /var/lib/apt-xapian-index/values. Add a '-' to reverse sort order --tags show matching tags, rather than packages --tabcomplete=TYPE suggest words for tab completion of the current command line (type is 'plain' or 'partial') --last use 'show --last' to limit tab completion to only the packages from the last search results --all disable pagination and always show all results. Note that search results are normally sorted by relevance, so you may find meaning- less results at the end of the output axi-cache 0.44 September 2011 AXI-CACHE(1)
All times are GMT -4. The time now is 06:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy