Sponsored Content
Top Forums Shell Programming and Scripting sed behaving oddly, repeats lines Post 302667833 by pereyrax on Saturday 7th of July 2012 01:51:25 PM
Old 07-07-2012
Question sed behaving oddly, repeats lines

Hi, all.

Here's the problem:

Code:
sed '/FOO/,/BAR/p'

That should print anything between FOO and BAR, right?

Well, let's say I have file.txt that contains just one line "how are you today?".
Then I run something like the above and get:

Code:
$ sed '/how/,/today/p' file.txt
how are you today?
how are you today?

It prints the line twice when I was expecting it to print just "are you".
I tried several text files with different content and also played around a little bit with quoting and regexps and in every case I got the line or the entire text duplicated.

I'm pretty sure the problem is mine and not sed's but I can't figure out what I'm doing wrong.

Any ideas?
- - - - - - - - -

Off Topic
Thanks to all of you out there. Reading this forum got me out of trouble many times Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search for repeats in text file - how?

I have a text file that I want to search for repeated lines and print those lines. These would be lines in the file that appear more than once. Is there a way to do this? Thanks (4 Replies)
Discussion started by: aarondesk
4 Replies

2. Shell Programming and Scripting

sed and cut behaving differently

I have attached a file with few records. First 2 characters of each record are binary characters. I can remove it by and it works fine. But is behaving differently and removing more than expected characters. Can someone help me in accomplishing it through sed? Thanks in advance. (13 Replies)
Discussion started by: amicon007
13 Replies

3. UNIX for Dummies Questions & Answers

awk repeats counter

if I wanted to know if the word DOG(followed by several random numbers) appears in col 1, how many times will that same word DOG* appeared in col 2? This is a very large file Thanks! (7 Replies)
Discussion started by: verse123
7 Replies

4. UNIX for Dummies Questions & Answers

Can't figure out why this repeats

#!/bin/sh while IFS=: read address port; do : ${port:=443} address=$address port=$port cd $f_location number=`grep "$address" thing.txt -A 1 | grep "addresses=" | cut -d'"' -f2` echo "$address,$port,$number,$answer" >>... (9 Replies)
Discussion started by: shade917
9 Replies

5. Shell Programming and Scripting

Remove brackets repeats and separate in columns

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (4 Replies)
Discussion started by: manigrover
4 Replies

6. Solaris

Remove oddly named file

I accidentally saved a txt file in vi with the name ":q!". no amount of regex tomfoolery I can think of will allow me to remove the file. anyone got any ideas? (4 Replies)
Discussion started by: os2mac
4 Replies

7. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies

8. UNIX for Beginners Questions & Answers

Non printing option in sed is behaving oddly

Hi I'm having a problem with a sed command that I thought I was using correctly but apparently that's not the case. I was hoping someone here could point out what it is I am doing wrong? I am using the print, no print option for a matched pattern in sed. Everything seemed to be working fine... (5 Replies)
Discussion started by: Paul Walker
5 Replies

9. UNIX for Beginners Questions & Answers

Non printing option in sed is behaving oddly

Hi I'm having a problem with a sed command that I thought I was using correctly but apparently that's not the case. I was hoping someone here could point out what it is I am doing wrong? I am using the print, no print option for a matched pattern in sed. Everything seemed to be working fine... (2 Replies)
Discussion started by: harveyclayton
2 Replies
KRB.EXCL(5)							AFS File Reference						       KRB.EXCL(5)

NAME
krb.excl - Lists exclusions for mapping kerberos principals to AFS identities DESCRIPTION
/etc/openafs/server/krb.excl is an optional file that resides on an OpenAFS server and is used to list exceptions to the algorithm of mapping kerberos principals to AFS identities. It contains the name of one or more principals; each principal should be on a line by itself. If a principal appears in this file, that principal will never be recognized by an OpenAFS server as a local identity, even if the realm is specified as a local realm in krb.conf(5). The principal names specified in this file must include the realm, and should be in Kerberos 4 format. That is, specify "user.inst@REALM", not "user/inst@REALM", "user.inst", nor "user/inst". RATIONALE
It is possible to use the krb.conf(5) configuration file to specify that multiple Kerberos realms can be considered `local' realms by OpenAFS fileservers, and those realms can be used nearly interchangeably. A site may list "FOO.EXAMPLE.COM" and "BAR.EXAMPLE.COM" to allow users to access AFS by using Kerberos tickets from either "FOO.EXAMPLE.COM" or "BAR.EXAMPLE.COM", and be treated as AFS users local to that cell. In many setups, one realm is really a `local' realm that is managed by the AFS administrators, and another `foreign' realm is specified in krb.conf that is managed by someone else, but in the same organization. In such a case, the principal names for users are the same, so users should be able to use either realm to authenticate to AFS. However, the principals for administrators are not the same between the two realms, and so the administrators in the `foreign' realm should not be considered AFS administrators. Specifying the administrator principals in the `foreign' realm prevents this, but still allows users to use either realm. EXAMPLES
The realms "FOO.EXAMPLE.COM" and "AD.EXAMPLE.COM" are configured to both be local realms, but "AD.EXAMPLE.COM" should not be used by AFS administrators. The AFS administrators are "admin" and "smith.admin". krb.excl contains: admin@AD.EXAMPLE.COM smith.admin@AD.EXAMPLE.COM Now if someone authenticates with tickets for "smith/admin@AD.EXAMPLE.COM", they will not be recognized as the "smith.admin" AFS identity. However, "smith@AD.EXAMPLE.COM" will be treated as the "smith" AFS identity, and "smith/admin@FOO.EXAMPLE.COM" will still be treated as "smith.admin". SEE ALSO
krb.conf(5) COPYRIGHT
Copyright 2010 Sine Nomine Associates This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Andrew Deason for OpenAFS. OpenAFS 2012-03-26 KRB.EXCL(5)
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy