Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Setting a variable to result of FIND command Post 65847 by JP Favara on Wednesday 9th of March 2005 03:15:36 PM
Old 03-09-2005
Setting a variable to result of FIND command

I am working on a batch script where a filter is placed on a directory, and the files that come out of that filter have to be copied into another directory. More specifically, I am trying to set the results of a FIND command to a variable, so that I may access this variable / file later.
The command I have now is:
dir | find "03/07/2005 03:17 PM"|\\ramts11\MarketData\Diag\utils\cut.exe -d " " -f14
The output is in the form of a text file, like:
ccm000000493.txt
I need to store the name of this file in a variable so I can copy it to a different directory. I tried putting
SET /a CCMFile=
in front of the command, but that does not assign CCMFile to anything (the variable CCMFile is still set as null).

Any help would be greatly appreciated.
Thanks a lot,
John Favara
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find command not returning any result

I am looking for all the header files (*.h).. which as per documentation of the UNIX system shouldbe there. I am using find / -name *.h -print But it does't give anything. My question is under what condition the "find" condition will fail to find the file? What is the work around. ... (4 Replies)
Discussion started by: rraajjiibb
4 Replies

2. Shell Programming and Scripting

storing result of a command in variable

For whatever reason I cant seem to fix my syntax to do the following. I want to run a grep and count how many instances come up and store that number in a variable but I keep erroring out. Here's my code in bash: number=grep blah file.txt | wc -l (1 Reply)
Discussion started by: eltinator
1 Replies

3. Shell Programming and Scripting

sh : Problem with the result of a find command

Hi I'm working on solaris and I'm trying to run a script. The part listed here does not work properly, the result of the find command is not in the output file /tmp/result (I've checked the find command , executing the shell with sh -x , it seems correct). It seems like I've lost the standard... (4 Replies)
Discussion started by: frenchwill
4 Replies

4. Shell Programming and Scripting

assign awk command result to a variable

#!/bin/sh # ## MYSTRING = `awk '/myApp.app/' /Users/$USER/Library/Preferences/loginwindow.plist` if then echo String not found defaults write /Users/$USER/Library/Preferences/loginwindow AutoLaunchedApplicationDictionary -dict-add -string Hide -bool YES -string Path -string... (9 Replies)
Discussion started by: dedmakar
9 Replies

5. UNIX for Dummies Questions & Answers

Find command - result order

Hi! Could you please explain why the result order isn't in reverse time order as it is requestet by "xargs ls -ltr" command (ksh shell)? There are about 5000 files in dir. $ find . -name "*201010*" -print |xargs ls -ltr |tail -rw-r--r-- 1 oracle oinstall 54326 Nov 25 20:32... (2 Replies)
Discussion started by: laki47
2 Replies

6. Windows & DOS: Issues & Discussions

Read command result as variable

Hi all, Is there a simple way to read a command output as a variable? I've running a batch file to do: attrib.exe * | find /c /v "" >filecount.txt but rather than write it to the txt file I'd like to read the total in as a variable to pass to the rest of the bat file... Any help much... (1 Reply)
Discussion started by: Grueben
1 Replies

7. Shell Programming and Scripting

Assign the result of a multiline command to a variable

Hi, I have the following command that lists all the .o files from all the directories except of vwin (which I don't want it) for i in `ls -d */*.o|awk '$0 !~ "vwin"'`; do echo $i; done The result is something like that dir1/file1.o dir1/file2.o dir2/file3.o etc. So, I want to create a... (9 Replies)
Discussion started by: scor6800
9 Replies

8. UNIX for Dummies Questions & Answers

Strange result using find command.

I created a file with the permissions of 776. When I ran the command find /root/Desktop -perm -644 -type f The created file shows up as part of the results. Doesn't -perm -mode mean that for global, only 4(read) and 2(write) can be accepted ? (2 Replies)
Discussion started by: Hijanoqu
2 Replies

9. Shell Programming and Scripting

Unexplained result of 'find' command

Given this bit of script: retprd=$1 find ${extrnllogdir} -name "*.log" -mtime +$retprd -exec ls -l {} \; >> $logfile produces this (with 'set -x') ++ find /xfers/oracle/dw/data -name '*.log' -mtime +60 -exec ls -l '{}' ';' find: /xfers/oracle/dw/data/cron: Permission denied Where is he... (5 Replies)
Discussion started by: edstevens
5 Replies

10. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies
evmfilterfile(4)					     Kernel Interfaces Manual						  evmfilterfile(4)

NAME
evmfilterfile - Event Manager filter file SYNOPSIS
DESCRIPTION
A filter file contains one or more filter descriptions, which can be referenced through certain EVM commands by using indirect filter syn- tax. An indirect filter specifier has the following form: In the previous indirect filter specifier, filename is the name of a filter file, and filter_name is the name of a filter contained in the file. If no filter_name is specified, the first filter in the file is used. By convention, filter file names should have the suffix If a command cannot find the file with the name as specified, it appends and tries again. If a relative pathname is given for a file, commands search for the file in each location specified by the environment variable if it is present. Otherwise the search is performed in the following standard locations in turn, stopping as soon as the file is found: o The current working directory o o Several supplied filter files, containing shortcut filters for many system events, can be found in the directory System administrators should place site-specific filter files in The filter file is made up of a series of keyword/value and keyword/group pairs. Values containing spaces must be enclosed in double quotes. Strings may be continued across a newline by finishing the line with a backslash character. Any portion of a line from an unquoted number sign to the end of line is a comment. Blank lines are ignored. The following keywords are recognized: Introduces a filter group. Names the filter. The filter_value is a string that conforms to EVM filter syntax. See the EvmFilter(5) manpage for information about filter syntax. Modifies the current filter_value. See the description of the and keywords below. Modifies the current filter_value. See the description of the and keywords below. The filter_title is a text string that describes the purpose of the filter. The title is not currently used, but always should be included. The and keywords can appear multiple times in a filter group, allowing you to build and maintain a filter in simple single-line increments. Each filter_element must be a valid filter string, conforming to the syntax described in the EvmFilter(5) manpage. A complete filter string is assembled by surrounding the initial filter with parentheses and appending the filter_elements to it, separating each with a log- ical (for or (for operator. For example: The previous filter lines are equivalent to this more complex single filter line: The first line selects all events with a priority of 200 or greater, the next modifies this by selecting all events from regardless of their priorities, and the last line excludes all events regardless of their priorities. If you prefer, you can omit the command, and build the complete filter string from and lines. Notes If you are concerned with allowing your file to be used on other systems that support EVM in the future, you should use the built-in macro in place of the first two components of the name of any system event. This will make it unnecessary to change the file if the other system uses a different event name prefix. EXTERNAL INFLUENCES
Environment Variables A colon-separated set of directory pathnames to be searched for a requested filter file. If this variable is present in the environment the directories are searched in place of the standard directories. EXAMPLES
1. The following is an example of a pair of entries in a filter file: 2. The following command finds and displays all EVM events, using a filter stored in the supplied filter file 3. Assuming that the filter file shown in the first example is named and is located in a standard filter directory, the following command displays the value of the filter from that file: FILES
Site-specific filter files. System filter files. SEE ALSO
Commands evmget(1), evmshow(1), evmwatch(1). Routines EvmFilterCreate(3), EvmFilterDestroy(3), EvmFilterIsFile(3), EvmFilterReadFile(3), EvmFilterSet(3), EvmFilterTest(3). Event Management EVM(5). EVM Events EvmEvent(5). Event Filter EvmFilter(5). evmfilterfile(4)
All times are GMT -4. The time now is 05:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy