Sponsored Content
Top Forums Shell Programming and Scripting Using SED command in a shell script: Unterminated address regex Post 302402566 by Alpha3363 on Wednesday 10th of March 2010 06:01:47 AM
Old 03-10-2010
Yes, because in this line, I just reteieve on Line from my exclusion file.
After that I concatene all the exclusion patterns with my sed command in green.
The real call off the sed command is in the blue line with input and output file:

Code:
buildGrep()
{
  nbl=`cat $exclusionFile | wc -l`
  i=1
  exclusion=`cat $exclusionFile | tail -${i} | head -1`
  exclusions="sed -e /${exclusion}/d"
  while [ $i -lt $((nbl+1)) ];
  do
         exclusions="${exclusions} -e '/${exclusion}/d'"
         i=`expr $i + 1`
         exclusion=`cat $exclusionFile | tail -${i} | head -1`
  done
  FinalExclusion=`${exclusions} <${TemporaryFile} >${aFiltered_monerrFile}`
}
aDate=`date '+%y.%m.%d_%H.%M.%S'`
aFiltered_monerrFile=Filtered_File.txt
TemporaryFile=TempFile$aDate.txt
ssh xxxx@xxxxx fgrep "2010\/03\/10" xxxxxxxxxxxxx/OriginalFile > $TemporaryFile
exclusionFile=xxxxx.dat
buildGrep
buildGrep()
{
  nbl=`cat $exclusionFile | wc -l`
  i=1
  exclusion=`cat $exclusionFile | tail -${i} | head -1`
  exclusions="sed -e /'"${exclusion}"'/d"
  while [ $i -lt $((nbl+1)) ];
  do
         exclusions="${exclusions} -e '/${exclusion}/d'"
         i=`expr $i + 1`
         exclusion=`cat $exclusionFile | tail -${i} | head -1`
  done
  FinalExclusion=`${exclusions} <${TemporaryFile} >${aFiltered_monerrFile}`
}
aDate=`date '+%y.%m.%d_%H.%M.%S'`
aFiltered_monerrFile=Filtered_File.txt
TemporaryFile=TempFile$aDate.txt
ssh xxxx@xxxxx fgrep "2010\/03\/10" xxxxxxxxxxxxx/OriginalFile > $TemporaryFile
exclusionFile=xxxxx.dat
buildGrep

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed command in shell script

I have a current code working(named subst1) having a user be able to type this line to substitute words using the sed command: subst1 old-pattern new-pattern filename Here is my shell script: #!/bin/bash # subst1 ARGS=3 E_BADARGS=65 if then echo "Usage: `basename $0`... (1 Reply)
Discussion started by: Todd88
1 Replies

2. Shell Programming and Scripting

sed unterminated `s' command?

Hi there, I'm pretty new to this whole scripting thing. I've written myself something which takes my txt file of SMSes (the backup from the phone), and puts them into an email format, saving them as .eml files. I've tested and uploaded a batch to gmail, but because of threading issues, I've... (1 Reply)
Discussion started by: donnacha
1 Replies

3. Shell Programming and Scripting

[Solved] sed - query - unterminated suddenly

Hi, I have been trying to get various sed statements to work. I thought I had cracked it when suddenly I start recieving these messages "sed: -e expression #1, char 14: unterminated 's' command" It happens on any sed statement I now run. The only thing I have done inbetween trying to get... (0 Replies)
Discussion started by: mcclunyboy
0 Replies

4. Shell Programming and Scripting

sed: -e expression #1, char 21: unterminated `s' command

I have read many threads, but I still didn't find the right answer. May be i didn't find the right thread, though are so many threads for the same question. Basically the situation is - find date in a file and replace it with another date. (its not homework, its part of lot of a big processing,... (10 Replies)
Discussion started by: avinthm
10 Replies

5. UNIX for Dummies Questions & Answers

sed error unterminated `s' command

I have list of data I have cut down to format: I am using sed command to remove the sed 's/ Returns error: sed: -e expression #1, char 5: unterminated `s' command Full code line is: cat textFile | cut -d ' ' -f 4 | cut ':' -f 1 | sed 's/ Thanks, Please use next time code tags... (2 Replies)
Discussion started by: maximus73
2 Replies

6. Shell Programming and Scripting

SED With Regex to extract Email Address

Hi Folks, In my program, I have a variable which consists of multiple lines. i need to use each line as an input. My intention is to extract the email address of the user in each line and use it to process further. The email address could be anywhere in the whole line. But there will be only... (5 Replies)
Discussion started by: ragz_82
5 Replies

7. Shell Programming and Scripting

sed returns error "sed: -e expression #1, char 18: unterminated `s' command"

Hello All, I have something like below LDC100/rel/prod/libinactrl.a LAA2000/rel/prod/libinactrl.a I want to remove till first forward slash that is outputshould be as below rel/prod/libinactrl.a rel/prod/libinactrl.a How can I do that ??? (8 Replies)
Discussion started by: anand.shah
8 Replies

8. Shell Programming and Scripting

Need Help with a sed command involving Regex

Hi, Iam a newbie to SED. I'm faced with a problem as described. Given the file with text 1 rwerwerwe rere 2 fdfefefe fsdfds 3 rerere ffff trtrt 4 aaaa 1234 asadsdsd 5 hfjfjfjsjfsf... (14 Replies)
Discussion started by: SShinde
14 Replies

9. Shell Programming and Scripting

Sed: -e expression #1, char 16: unterminated address regex

I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine. ... (23 Replies)
Discussion started by: rbadveti
23 Replies

10. UNIX for Beginners Questions & Answers

Sed: -e expression #1, char 20: unterminated address regex

I am trying to add word in last of particular line. the same command syntex is running on prompt. but in bash script give error."sed: -e expression #1, char 20: unterminated address regex" Please help. for i in `cat servername`; do ssh -q -t root@$i sed -i '/simple_allow_groups =/s/$/,... (4 Replies)
Discussion started by: yash_message
4 Replies
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a file name containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)
All times are GMT -4. The time now is 12:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy