Sponsored Content
Top Forums Shell Programming and Scripting Extraction problem with sed command Post 302949095 by Shilpi Gupta on Tuesday 7th of July 2015 06:10:48 AM
Old 07-07-2015
Extraction problem with sed command

Hi All

I am trying to remove the line having specific pattern from a file by using sed command

I have the file named ODS_REP_SRCE_File.txt with content as:

Code:
"FOLDR=$Path;FILE=$0;SRCDB=$ODS_REP_SRCE;SRCTBL=AP_INVC_DETL_F_V,AP_INVC_DETL_F_V,AP_CHECK_F_V,AP_INVC_PYMT_DTL_F_V;TGTDB=$EDW_TARGT;TGTTBL=AP_INVC_DETL_FS;JOBID=N/A;LOADTYP=DAILY;SRVPROCID=$$;TS=$QB_TS;"`
$ODS_REP_SRCE.AP_INVC_F_V
$ODS_REP_SRCE.AP_INVC_FX_V
$ODS_REP_SRCE.AP_INVC_FX_V
$ODS_REP_SRCE.AP_INVC_FX_V
$ODS_REP_SRCE.AP_INVC_F_V
$ODS_REP_SRCE.GCD_CURR_MAIN_D_V
$ODS_REP_SRCE.GCD_CURR_MAIN_D_V
$ODS_REP_SRCE.ORG_MAIN_D_V
$ODS_REP_SRCE.GCD_CURR_MAIN_D_V
$ODS_REP_SRCE.GCD_CURR_MAIN_D_V
$ODS_REP_SRCE.GCD_CURR_RT_HIST_F_V
$ODS_REP_SRCE.GCD_CURR_RT_HIST_F_V
$ODS_REP_SRCE.GCD_CURR_RT_HIST_F_V
$ODS_REP_SRCE.GCD_CURR_RT_HIST_F_V
$ODS_REP_SRCE.AP_INVC_F_V
$ODS_REP_SRCE.AP_INVC_FX_V
$ODS_REP_SRCE.AP_INVC_FX1_V

I am using the below code:

Code:
  
 sed '/$DB_Name\;/d' ODS_REP_SRCE_File.txt

where $DB_Name value as ODS_REP_SRCE so my search pattern is "ODS_REP_SRCE;"

But the output is not deleting the 1st line which match the pattern.

Please let me Know how to handle this scenario..

Thanks,
Moderator's Comments:
Mod Comment Please use CODE tags for sample input and output as well as for code segments.

Last edited by Don Cragun; 07-07-2015 at 03:52 PM.. Reason: Add data CODE tags.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command problem

I am cating a file with passwords into another file. I want to replace the the password with **** and it is not working. Here is my command cat testing | sed 's/`echo ${pass}`/*****/'>>out1 ${pass} is the password that I want to replace before it goes into out1 Anyone know what I am... (1 Reply)
Discussion started by: lesstjm
1 Replies

2. Shell Programming and Scripting

SED scipt help - line extraction

Forgive me if this is a dumb question...I'm a Windows sys admin with little programming knowledge. I have files containing anywhere from 3 to 200 lines. Using SED, I want to extract only lines containing a specific instance of "ISS." It is possible that "ISS" will occur several times in a... (10 Replies)
Discussion started by: thuston22
10 Replies

3. Shell Programming and Scripting

Sed/awk gods, I need your Help! Fancy log extraction

Hi! I'm trying to find a way to extract a certain amount of lines from a log file. This would allow me to "follow" a web user through our log files. Here is a sample fake log file to explain what i want to accomplish : BEGIN REQUEST sessionID=123456 boatload of lines for thread-1 detailing... (8 Replies)
Discussion started by: gnagus
8 Replies

4. Shell Programming and Scripting

extraction of samba shares with sed

Hi there, My samba configuration file looks like that : ... ... path = /home/samba/profiles/ ... path = /home/samba/shares/family valid users = family path = /home/samba/shares/admins valid users = admins path = /home/samba/shares/publicI want to extract the list of standard... (3 Replies)
Discussion started by: chebarbudo
3 Replies

5. Shell Programming and Scripting

Extraction of text using sed or awk command

Hi All, I need to extract 543 from the command below : # pvscan PV /dev/sdb1 VG vg0 lvm2 Total: 1 543.88 GB] / in use: 1 / in no VG: 0 I have the following command which does the job, but I think this could be achieved in a more simple way using sed or awk. Any help is... (7 Replies)
Discussion started by: nua7
7 Replies

6. Shell Programming and Scripting

Obscure sed extraction syntax

Hi, Could anyone clearly explain me the below sed construct in detail to get to know what it actually does? sed 's/\(* *\)//4' echo 'test;10;20' | sed 's/*;\(*\)/\1/' (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. UNIX for Dummies Questions & Answers

awk/sed match and extraction

Hi, I have a file like this- aa 12 23 34 aa 21 34 56 aa 78 45 56 I want to print out only the lines after the last aa. How do I do this? I tried using grep -A and sed -n, but both didnt work as I wanted to. Could someone help me out please.. (3 Replies)
Discussion started by: jamie_123
3 Replies

8. Shell Programming and Scripting

sed text extraction between 2 patterns using variables

Hi everyone! I'm writting a function in .bashrc to extract some text from a file. The file looks like this: " random text Begin CG step 1 random text Begin CG step 2 ... Begin CG step 100 random text" For a given number, let's say 70, I want all the text between "Begin CG... (4 Replies)
Discussion started by: radudownload
4 Replies

9. UNIX for Dummies Questions & Answers

sed command problem

Hi i am reading a tutorial on sed below command was given in tutorial. i am not able to understand the working of below command also this command is now working in my enviroment. $ sed -n '1~2p' alarm sed: 1: "1~2p": invalid command code ~ $ need your assitance here (7 Replies)
Discussion started by: scriptor
7 Replies
Locale::Codes::LangFam(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangFam(3pm)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::LangFam(3pm)
All times are GMT -4. The time now is 07:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy