Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to ignore mutiple strings when using shell script? Post 303043786 by sravani25 on Thursday 6th of February 2020 06:20:26 PM
Old 02-06-2020
How to ignore mutiple strings when using shell script?

Hi All,

I am trying to use below syntax to find ignore multiple locations while searching for a file.

Code:
find / -name "$serviceitem" ! -size 0  2>&1 |egrep -v "tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest"

I tried to assign all the ignore strings to one variable like below

Code:
ignore_list=`tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest`
find / -name "$serviceitem" ! 2>&1 |egrep -v "$ignore_list"

But it's throwing error.

Can someone please let me know how to use the above syntax.
Moderator's Comments:
Mod Comment Please use CODE TAGS for your samples as per forum rules. Also please do not use colours to your posts.

Last edited by RavinderSingh13; 02-06-2020 at 09:46 PM..
 

10 More Discussions You Might Find Interesting

1. IP Networking

Script to assign mutiple IP's to 1 nic

I need a script to assign multiple IP addresses to a single nic. The machine is running CentOS. Any help would be appreciated. (2 Replies)
Discussion started by: ron310
2 Replies

2. Homework & Coursework Questions

strings in shell script!

hi ppl, I have a basic doubt as to how shell treats strings. e.g:given a line of data like this "5","6","45","77","89" extracting the value from each field to a variable will conatin a string("5") or just the number? If it conatins "5", how do we perform mathematical operations with that... (3 Replies)
Discussion started by: beetel
3 Replies

3. Shell Programming and Scripting

Shell script to replace strings to and from a file

Hello All, I have 2 files 1 ) source file eg asasa 1.2.3.4 adfhsdfsdfasdf zxzxzx 2.3.4.56 dsadasdasdsadasd kjjkjkjk 30.3.4.5 asdsadsadsadsadsad vxcvxcvx 1.2.3.4 qwewqewqeqweqwe 2) patern file 1.2.3.4 A 2.3.4.56 B 30.3.4.5 C I need the source to be changed to asasa A... (2 Replies)
Discussion started by: nitinkgoud
2 Replies

4. Shell Programming and Scripting

Find associated strings in a bash shell script

Hi together, unfortunately I am not a shell script guru - the following might touch the depths of awk, substr, split, regexps, where I am still fighting with - but as always the boss needs a fast solution :-( So: I have the following USER/PASSWORD-installation-config-file, from where I want to... (10 Replies)
Discussion started by: Sofie
10 Replies

5. Shell Programming and Scripting

Shell Script to ignore # and take corresponding user and group

Hi, I have a following file: role.IMPACT_USER.user=admin role.IMPACT_USER.user=dd12345 role.IMPACT_USER.user=ss76767 #role.IMPACT_USER.user=root #role.IMPACT_USER.group=System role.IMPACT_USER.group=ImpactUser #Description: Allow users to login in to Impact, start and stop service... (5 Replies)
Discussion started by: dbashyam
5 Replies

6. Shell Programming and Scripting

Ignore lines in Shell Script

Hi, I have a shell script, which reads a *.txt file - line by line. In this text file, I have some lines beginning with "#" that I want to ignore : MY_FILE #blah blah blah 1 blah blah blah 2 blah blah blah 3 #blah blah blah 4 I want my script to read only the following lines... (3 Replies)
Discussion started by: ad23
3 Replies

7. Shell Programming and Scripting

awk based script to ignore all columns from a file which contains character strings

Hello All, I have a .CSV file where I expect all numeric data in all the columns other than column headers. But sometimes I get the files (result of statistics computation by other persons) like below( sample data) SNO,Data1,Data2,Data3 1,2,3,4 2,3,4,SOME STRING 3,4,Inf,5 4,5,4,4 I... (9 Replies)
Discussion started by: ks_reddy
9 Replies

8. Shell Programming and Scripting

Shell script with mutiple steps/commands, on UNIX servers

Hi, I wrote a simple script, which will call other scripts or run commands on a UNIX server. my script has multiple steps/commands with some delay in between. I usually get some email notifications after the successful execution of each step. **My intention is to get email alerts when it is... (5 Replies)
Discussion started by: System Admin 77
5 Replies

9. Shell Programming and Scripting

Ignore Folder in Shell Script ?

Hi, I currently use a script to extract *.deb files located in a Directory called "/var/mobile/Media/Downloads" The Problem is howver I want the script to ignore the folder: "/var/mobile/Media/Downloads/New Debs and Files" (it shall NOT decompile any of the files in that folder. Here is... (2 Replies)
Discussion started by: pasc
2 Replies

10. Shell Programming and Scripting

Merge strings with ignore case

I have a bi-lingual database of a large number of dictionaries. It so happens that in some a given string is in upper case and in others it is in lower case. An example will illustrate the issue. toll Tax=पथ-कर Toll tax=राहदारी कर toll tax=टोल I want to treat all three instances of toll tax... (3 Replies)
Discussion started by: gimley
3 Replies
exit(1)                                                            User Commands                                                           exit(1)

NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps SYNOPSIS
sh exit [n] return [n] csh exit [ ( expr )] goto label ksh *exit [n] *return [n] DESCRIPTION
sh exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of the last command executed (an EOF will also cause the shell to exit.) return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe- cuted. csh exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the expression expr. The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to jump to a label that occurs between a while or for built-in command and its corresponding end. ksh exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit except for a shell which has the ignoreeof option (See set below) turned on. return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return is invoked while not in a function or a '.' script, then it is the same as an exit. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
break(1), csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 15 Apr 1994 exit(1)
All times are GMT -4. The time now is 07:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy