Sponsored Content
Top Forums Shell Programming and Scripting Grep for an exact match in a file Post 303000459 by MadeInGermany on Wednesday 12th of July 2017 02:00:50 PM
Old 07-12-2017
You certainly want another variable substitution, and the fix is another time double quotes: sed "s,_.._$DATE,,g"
Also it is a good idea to put double quotes around all variables, in order to allow their substitution but not additional expansions. Together with some more suggestions:
Code:
TRIM_FILENAME=`echo "$FILENAME" | sed "s,_.._$DATE,,"`
grep -E "^${TRIM_FILENAME}$" "$REFERENCE/$Valid_List"
        if [ $? -eq 0 ] # exit status of the previous command
        then
                printf "%s\n" "$FILENAME needs to be sent"
 
                hadoop fs -cp "$line" "$OUTPUT_DIR"
                echo "successfully sent"
        else
                printf "%s\n\n" "$FILENAME does not need to be sent"
                exit 8
        fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Exact Match thru grep ?????

hey..... i do have text where the contents are like as follows, FILE_TYPE_NUM_01=FILE_TYPE=01|FILE_DESC=Periodic|FILE_SCHDL_TYPE=Daily|FILE_SCHDL=|FILE_SCHDL_TIME=9:00am|RESULTS=B FILE_TYPE_NUM_02=FILE_TYPE=02|FILE_DESC=NCTO|FILE_SCHDL_TYPE=Daily|FILE_SCHDL=|FILE_SCHDL_TIME=9:00am|RESULTS=M... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

2. Shell Programming and Scripting

Using grep returns partial matches, I need to get an exact match or nothing

I’m trying to modify someone perl script to fix a bug. The piece of code checks that the zone name you want to add is unique. However, when the code runs, it finds a partial match using grep, and decides it already exists, so the “create” command exits. $cstatus = `${ZADM} list -vic | grep... (3 Replies)
Discussion started by: TKD
3 Replies

3. Solaris

grep exact match

Hi This time I'm trying to grep for an exact match e.g cat.dog.horse.cow.bird.pig horse.dog.pig pig.cat.horse.dog horse dog dog pig.dog pig.dog.bird how do I grep for dog only so that a wc -l would result 2 in above case. Thanks in advance ---------- Post updated at 06:33 AM... (4 Replies)
Discussion started by: rob171171
4 Replies

4. UNIX for Dummies Questions & Answers

grep and sed exact match questions

This was mistaken as homework in a different forum, but is not. These are questions that are close to what I am trying to do at work. QUESTION1: How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed. Contents of car.txt CAR1_KEY0 CAR1_KEY1... (1 Reply)
Discussion started by: thibodc
1 Replies

5. Shell Programming and Scripting

grep and sed exact match questions

This post was previously mistaken for homework, but is actually a small piece of what I working on at work. Please answer if you can. QUESTION1 How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed. Contents of car.txt CAR1_KEY0 CAR1_KEY1... (2 Replies)
Discussion started by: thibodc
2 Replies

6. Shell Programming and Scripting

Grep two words with exact match

HI Input : Counters Counter Int Ints Counters Counters Ints Ints I want to grep Counter|Int Output : Counter (1 Reply)
Discussion started by: pareshkp
1 Replies

7. Shell Programming and Scripting

Searching for exact match using grep

I am searching for an exact match on a value read from another file to lookup an email address in another file. The file being checked is called "contacts" and it has Act #, email address, and contact person. 1693;abc1693@yahoo.comt;Tommy D 6423;abc6423@yahoo.comt;Jim Doran... (2 Replies)
Discussion started by: ziggy6
2 Replies

8. Shell Programming and Scripting

Grep multiple exact match, do not display lines

Hi, Need help to grep the following from a file x. I just want to grep exact match not lines and not partial word. CONFSUCCESS CONFFAIL CONFPARTIALSUCCESS >cat x xczxczxczc zczczcxx CONFSUCCESS czczczcczc czxxczxzxczcczc CONFFAIL xczxczcxcczczc zczczczcz CONFPARTIALSUCCESS czczxcxzc ... (4 Replies)
Discussion started by: rajeshwebspere
4 Replies

9. Shell Programming and Scripting

Grep or sed - printing line only with exact match

Hello. In my script, some command return : q | kernel-default | package | 3.19.0-1.1.g8a7d5f9 | x86_64 | openSUSE-13.2-Kernel_stable_standard | kernel-default | package | 3.19.0-1.1.g8a7d5f9 | i586 | openSUSE-13.2-Kernel_stable_standard | kernel-default ... (3 Replies)
Discussion started by: jcdole
3 Replies

10. Shell Programming and Scripting

Grep exact match

Hello! I have 2 files named tacs.tmp and tacDB.txt tacs.tmp looks like this 0 10235647 102700 106800 107200 1105700 tacDB.txt looks like this 100100,Mitsubishi,G410,Handheld,,0,0,0 100200,Siemens,A53,Handheld,,0,0,0 100300,Sony Ericsson,TBD (AAB-1880030-BV),Handheld,,0,0,0... (2 Replies)
Discussion started by: Cludgie
2 Replies
BRANDY(1)						      BBC BASIC V interpreter							 BRANDY(1)

NAME
brandy - a portable BBC BASIC V interpreter SYNOPSIS
brandy [-help] [-size SIZE] [-lib FILENAME] [-load FILENAME] [-path DIRECTORY[,DIRECTORY]...] [-quit FILENAME] [-chain FILENAME] [-ignore] [FILENAME] DESCRIPTION
Brandy is an interpreter for BBC BASIC V, the dialect of BASIC that Acorn Computers supplied with their ranges of desktop computers that use the ARM processor such as the Archimedes and Risc PC, and is still in use on these and compatibles. BASIC V is a much extended version of BBC BASIC. This was the BASIC used on the 6502-based BBC Micro that Acorn made during the 1980s. OPTIONS
-help Print a summary of these options. -size SIZE Set the size of the Basic workspace to SIZE bytes when starting the interpreter. The minimum size allowed is 10000 bytes and any- thing below this value will be set to it. The maximum size is limited only by the environment in which the program is being run. The size may have a suffix of k to denote that the size is in kilobytes or m if it is in megabytes. For example, -size 100k will set the workspace size to 100 kilobytes (102400 bytes) and -size 8m will set it to eight megabytes (8388608 bytes). -lib FILENAME Load Basic library FILENAME when the interpreter starts. This option can be repeated as many times as required to load a number of libraries. This is equivalent to typing INSTALL "FILENAME" at the interpreter's command line. The libraries are loaded in the order given on the command line. Note that the search order is the reverse of this. -load FILENAME Load Basic program FILENAME when the interpreter starts. -path DIRECTORY[,DIRECTORY]... This specifies a list of directories that the interpreter will search when looking for libraries and programs. The directory names are separated by commas. The pseudo-variable FILEPATH$ is set to this value. -quit FILENAME Load and run the Basic program FILENAME. Leave the interpreter when the program has finished running. -chain FILENAME Load and run the Basic program FILENAME. Remain in the interpreter when the program has finished running. -graphics Start the interpreter with the screen in graphics mode in versions of the program which support graphics and the screen can be in either text or graphics modes. -ignore Ignore certain `unsupported feature' errors. By default the interpreter reports an error whenever it comes across a BASIC V feature that it does not support. This option allows some unsupported features that do not affect the basic running of the program to be ignored. FILENAME This is exactly equivalent to -chain. The case of the names of the options is ignored. It depends on the operating system under which the interpreter is running as to whether the names of files are case sensitive or insensitive. FILES
brandy executable /usr/share/doc/brandy/examples example BASIC programs SEE ALSO
/usr/share/doc/brandy full documentation Brandy's home page http://jaguar.orpheusweb.co.uk/branpage.html There is some very useful documentation for the BBC Micro available on the Internet. One very good site is The BBC Lives! at: http://www.nvg.ntnu.no/bbc/ or see http://sourceforge.net/projects/brandy/ AUTHOR
David Daniels, with contributions from Darren Salt and Colin Tuckley REPORTING BUGS
Report bugs to the bug tracker at http://sourceforge.net/projects/brandy COPYRIGHT
Copyright (c) 2000, 2001 David Daniels. Copyright (c) 2009, 2012 Colin Tuckley. This is free software; see the source for copying condi- tions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. brandy 1.20pre5 10 Jun 2012 BRANDY(1)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy