Extract substring according to regexp with sed or grep Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionCan grep output only specified groupings that match?How to treat a file as a single line with grep to apply a regexp search pattern?Extracting a regex matched with 'sed' without printing the surrounding charactersgrep (/sed/awk) month rangeFunction to simplify grep with an often used logUsing sed instead of grep to output only matching part of lineErasing 2-lines pattern with sed/grep/whateverHow to split an output to two files with grep?How to make BSD grep respect start-of-line anchorbash script to replace script tags in html with their content

Significance of Cersei's obsession with elephants?

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

How were pictures turned from film to a big picture in a picture frame before digital scanning?

A term for a woman complaining about things/begging in a cute/childish way

Find 108 by using 3,4,6

Effects on objects due to a brief relocation of massive amounts of mass

What's the meaning of "fortified infraction restraint"?

Do any jurisdictions seriously consider reclassifying social media websites as publishers?

How could we fake a moon landing now?

Time to Settle Down!

Question about debouncing - delay of state change

As a beginner, should I get a Squier Strat with a SSS config or a HSS?

Why should I vote and accept answers?

Why do we bend a book to keep it straight?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

AppleTVs create a chatty alternate WiFi network

Trademark violation for app?

Most bit efficient text communication method?

What does it mean that physics no longer uses mechanical models to describe phenomena?

How to install press fit bottom bracket into new frame

Illegal assignment from sObject to Id



Extract substring according to regexp with sed or grep



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionCan grep output only specified groupings that match?How to treat a file as a single line with grep to apply a regexp search pattern?Extracting a regex matched with 'sed' without printing the surrounding charactersgrep (/sed/awk) month rangeFunction to simplify grep with an often used logUsing sed instead of grep to output only matching part of lineErasing 2-lines pattern with sed/grep/whateverHow to split an output to two files with grep?How to make BSD grep respect start-of-line anchorbash script to replace script tags in html with their content



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















In a (BSD) UNIX environment, I would like to capture a specific substring using a regular expression.



Assume that the dmesg command output would include the following line:



pass2: <Marvell Console 1.01> Removable Processor SCSI device


I would like to capture the text between the < and > characters, like



dmesg | <sed command>



should output:



Marvell Console 1.01


However, it should not output anything if the regex does not match. Many solutions including sed -e 's/$regex/1/ will output the whole input if no match is found, which is not what i want.



The corresponding regexp could be:
regex="^pass2: <(.*)>"



How would i properly do a regex match using sed or grep? Note that the grep -P option is unavailable in my BSD UNIX distribution. The sed -E option is available, however.










share|improve this question






















  • It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

    – JdeBP
    Mar 19 at 16:58

















4















In a (BSD) UNIX environment, I would like to capture a specific substring using a regular expression.



Assume that the dmesg command output would include the following line:



pass2: <Marvell Console 1.01> Removable Processor SCSI device


I would like to capture the text between the < and > characters, like



dmesg | <sed command>



should output:



Marvell Console 1.01


However, it should not output anything if the regex does not match. Many solutions including sed -e 's/$regex/1/ will output the whole input if no match is found, which is not what i want.



The corresponding regexp could be:
regex="^pass2: <(.*)>"



How would i properly do a regex match using sed or grep? Note that the grep -P option is unavailable in my BSD UNIX distribution. The sed -E option is available, however.










share|improve this question






















  • It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

    – JdeBP
    Mar 19 at 16:58













4












4








4








In a (BSD) UNIX environment, I would like to capture a specific substring using a regular expression.



Assume that the dmesg command output would include the following line:



pass2: <Marvell Console 1.01> Removable Processor SCSI device


I would like to capture the text between the < and > characters, like



dmesg | <sed command>



should output:



Marvell Console 1.01


However, it should not output anything if the regex does not match. Many solutions including sed -e 's/$regex/1/ will output the whole input if no match is found, which is not what i want.



The corresponding regexp could be:
regex="^pass2: <(.*)>"



How would i properly do a regex match using sed or grep? Note that the grep -P option is unavailable in my BSD UNIX distribution. The sed -E option is available, however.










share|improve this question














In a (BSD) UNIX environment, I would like to capture a specific substring using a regular expression.



Assume that the dmesg command output would include the following line:



pass2: <Marvell Console 1.01> Removable Processor SCSI device


I would like to capture the text between the < and > characters, like



dmesg | <sed command>



should output:



Marvell Console 1.01


However, it should not output anything if the regex does not match. Many solutions including sed -e 's/$regex/1/ will output the whole input if no match is found, which is not what i want.



The corresponding regexp could be:
regex="^pass2: <(.*)>"



How would i properly do a regex match using sed or grep? Note that the grep -P option is unavailable in my BSD UNIX distribution. The sed -E option is available, however.







sed grep regular-expression






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 19 at 13:30









SteinerSteiner

908




908












  • It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

    – JdeBP
    Mar 19 at 16:58

















  • It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

    – JdeBP
    Mar 19 at 16:58
















It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

– JdeBP
Mar 19 at 16:58





It's possibly better to parse the output of camcontrol devlist than the output of dmesg.

– JdeBP
Mar 19 at 16:58










3 Answers
3






active

oldest

votes


















7














Try this,



sed -nE 's/^pass2:.*<(.*)>.*$/1/p'


Or POSIXly (-E has not made it to the POSIX standard yet as of 2019):



sed -n 's/^pass2:.*<(.*)>.*$/1/p'


Output:



$ printf '%sn' 'pass2: <Marvell Console 1.01> Removable Processor SCSI device' | sed -nE 's/^pass2:.*<(.*)>.*$/1/p'
Marvell Console 1.01


This will only print the last occurrence of <...> for each line.






share|improve this answer

























  • This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

    – Steiner
    Mar 19 at 13:51






  • 1





    Why not use <([^>]+)>? I.e. not-> one-or-more times

    – Rich
    Mar 19 at 17:29






  • 1





    sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

    – RoVo
    Mar 20 at 7:02


















5














How about -o under grep to just print the matching part? We still need to remove the <>, though, but tr works there.



dmesg |egrep -o "<([a-zA-Z.0-9 ]+)>" |tr -d "<>"
Marvell Console 1.01





share|improve this answer
































    2














    I tried below 3 methods by using sed, awk and python



    sed command



    echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | sed "s/.*<//g"|sed "s/>.*//g"


    output



    Marvell Console 1.01


    awk command



    echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | awk -F "[<>]" 'print $2'


    output



    Marvell Console 1.01


    python



    #!/usr/bin/python
    import re
    h=[]
    k=open('l.txt','r')
    l=k.readlines()
    for i in l:
    o=i.split(' ')
    for i in o[1:4]:
    h.append(i)
    print (" ".join(h)).replace('>','').replace('<','')


    output



    Marvell Console 1.01





    share|improve this answer

























    • I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

      – jwm
      Mar 20 at 0:00











    • Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

      – D. Ben Knoble
      Mar 20 at 3:48











    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507188%2fextract-substring-according-to-regexp-with-sed-or-grep%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    Try this,



    sed -nE 's/^pass2:.*<(.*)>.*$/1/p'


    Or POSIXly (-E has not made it to the POSIX standard yet as of 2019):



    sed -n 's/^pass2:.*<(.*)>.*$/1/p'


    Output:



    $ printf '%sn' 'pass2: <Marvell Console 1.01> Removable Processor SCSI device' | sed -nE 's/^pass2:.*<(.*)>.*$/1/p'
    Marvell Console 1.01


    This will only print the last occurrence of <...> for each line.






    share|improve this answer

























    • This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

      – Steiner
      Mar 19 at 13:51






    • 1





      Why not use <([^>]+)>? I.e. not-> one-or-more times

      – Rich
      Mar 19 at 17:29






    • 1





      sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

      – RoVo
      Mar 20 at 7:02















    7














    Try this,



    sed -nE 's/^pass2:.*<(.*)>.*$/1/p'


    Or POSIXly (-E has not made it to the POSIX standard yet as of 2019):



    sed -n 's/^pass2:.*<(.*)>.*$/1/p'


    Output:



    $ printf '%sn' 'pass2: <Marvell Console 1.01> Removable Processor SCSI device' | sed -nE 's/^pass2:.*<(.*)>.*$/1/p'
    Marvell Console 1.01


    This will only print the last occurrence of <...> for each line.






    share|improve this answer

























    • This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

      – Steiner
      Mar 19 at 13:51






    • 1





      Why not use <([^>]+)>? I.e. not-> one-or-more times

      – Rich
      Mar 19 at 17:29






    • 1





      sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

      – RoVo
      Mar 20 at 7:02













    7












    7








    7







    Try this,



    sed -nE 's/^pass2:.*<(.*)>.*$/1/p'


    Or POSIXly (-E has not made it to the POSIX standard yet as of 2019):



    sed -n 's/^pass2:.*<(.*)>.*$/1/p'


    Output:



    $ printf '%sn' 'pass2: <Marvell Console 1.01> Removable Processor SCSI device' | sed -nE 's/^pass2:.*<(.*)>.*$/1/p'
    Marvell Console 1.01


    This will only print the last occurrence of <...> for each line.






    share|improve this answer















    Try this,



    sed -nE 's/^pass2:.*<(.*)>.*$/1/p'


    Or POSIXly (-E has not made it to the POSIX standard yet as of 2019):



    sed -n 's/^pass2:.*<(.*)>.*$/1/p'


    Output:



    $ printf '%sn' 'pass2: <Marvell Console 1.01> Removable Processor SCSI device' | sed -nE 's/^pass2:.*<(.*)>.*$/1/p'
    Marvell Console 1.01


    This will only print the last occurrence of <...> for each line.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 19 at 14:34









    Stéphane Chazelas

    315k57597955




    315k57597955










    answered Mar 19 at 13:43









    RoVoRoVo

    3,960317




    3,960317












    • This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

      – Steiner
      Mar 19 at 13:51






    • 1





      Why not use <([^>]+)>? I.e. not-> one-or-more times

      – Rich
      Mar 19 at 17:29






    • 1





      sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

      – RoVo
      Mar 20 at 7:02

















    • This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

      – Steiner
      Mar 19 at 13:51






    • 1





      Why not use <([^>]+)>? I.e. not-> one-or-more times

      – Rich
      Mar 19 at 17:29






    • 1





      sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

      – RoVo
      Mar 20 at 7:02
















    This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

    – Steiner
    Mar 19 at 13:51





    This works for me, with both the -n parameter and the /p suffix inside the regex. Full command i used: dmesg | sed -nE 's/^pass2: <(.*)>.*$/1/p

    – Steiner
    Mar 19 at 13:51




    1




    1





    Why not use <([^>]+)>? I.e. not-> one-or-more times

    – Rich
    Mar 19 at 17:29





    Why not use <([^>]+)>? I.e. not-> one-or-more times

    – Rich
    Mar 19 at 17:29




    1




    1





    sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

    – RoVo
    Mar 20 at 7:02





    sed regex is per default non-greedy, so it's not necessary here. But it would work, too.

    – RoVo
    Mar 20 at 7:02













    5














    How about -o under grep to just print the matching part? We still need to remove the <>, though, but tr works there.



    dmesg |egrep -o "<([a-zA-Z.0-9 ]+)>" |tr -d "<>"
    Marvell Console 1.01





    share|improve this answer





























      5














      How about -o under grep to just print the matching part? We still need to remove the <>, though, but tr works there.



      dmesg |egrep -o "<([a-zA-Z.0-9 ]+)>" |tr -d "<>"
      Marvell Console 1.01





      share|improve this answer



























        5












        5








        5







        How about -o under grep to just print the matching part? We still need to remove the <>, though, but tr works there.



        dmesg |egrep -o "<([a-zA-Z.0-9 ]+)>" |tr -d "<>"
        Marvell Console 1.01





        share|improve this answer















        How about -o under grep to just print the matching part? We still need to remove the <>, though, but tr works there.



        dmesg |egrep -o "<([a-zA-Z.0-9 ]+)>" |tr -d "<>"
        Marvell Console 1.01






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 19 at 20:02









        ilkkachu

        63.5k10104181




        63.5k10104181










        answered Mar 19 at 13:44









        Radek RadekRadek Radek

        1014




        1014





















            2














            I tried below 3 methods by using sed, awk and python



            sed command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | sed "s/.*<//g"|sed "s/>.*//g"


            output



            Marvell Console 1.01


            awk command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | awk -F "[<>]" 'print $2'


            output



            Marvell Console 1.01


            python



            #!/usr/bin/python
            import re
            h=[]
            k=open('l.txt','r')
            l=k.readlines()
            for i in l:
            o=i.split(' ')
            for i in o[1:4]:
            h.append(i)
            print (" ".join(h)).replace('>','').replace('<','')


            output



            Marvell Console 1.01





            share|improve this answer

























            • I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

              – jwm
              Mar 20 at 0:00











            • Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

              – D. Ben Knoble
              Mar 20 at 3:48















            2














            I tried below 3 methods by using sed, awk and python



            sed command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | sed "s/.*<//g"|sed "s/>.*//g"


            output



            Marvell Console 1.01


            awk command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | awk -F "[<>]" 'print $2'


            output



            Marvell Console 1.01


            python



            #!/usr/bin/python
            import re
            h=[]
            k=open('l.txt','r')
            l=k.readlines()
            for i in l:
            o=i.split(' ')
            for i in o[1:4]:
            h.append(i)
            print (" ".join(h)).replace('>','').replace('<','')


            output



            Marvell Console 1.01





            share|improve this answer

























            • I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

              – jwm
              Mar 20 at 0:00











            • Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

              – D. Ben Knoble
              Mar 20 at 3:48













            2












            2








            2







            I tried below 3 methods by using sed, awk and python



            sed command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | sed "s/.*<//g"|sed "s/>.*//g"


            output



            Marvell Console 1.01


            awk command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | awk -F "[<>]" 'print $2'


            output



            Marvell Console 1.01


            python



            #!/usr/bin/python
            import re
            h=[]
            k=open('l.txt','r')
            l=k.readlines()
            for i in l:
            o=i.split(' ')
            for i in o[1:4]:
            h.append(i)
            print (" ".join(h)).replace('>','').replace('<','')


            output



            Marvell Console 1.01





            share|improve this answer















            I tried below 3 methods by using sed, awk and python



            sed command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | sed "s/.*<//g"|sed "s/>.*//g"


            output



            Marvell Console 1.01


            awk command



            echo "pass2: <Marvell Console 1.01> Removable Processor SCSI device" | awk -F "[<>]" 'print $2'


            output



            Marvell Console 1.01


            python



            #!/usr/bin/python
            import re
            h=[]
            k=open('l.txt','r')
            l=k.readlines()
            for i in l:
            o=i.split(' ')
            for i in o[1:4]:
            h.append(i)
            print (" ".join(h)).replace('>','').replace('<','')


            output



            Marvell Console 1.01






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 19 at 20:01









            ilkkachu

            63.5k10104181




            63.5k10104181










            answered Mar 19 at 16:55









            Praveen Kumar BSPraveen Kumar BS

            1,7731311




            1,7731311












            • I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

              – jwm
              Mar 20 at 0:00











            • Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

              – D. Ben Knoble
              Mar 20 at 3:48

















            • I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

              – jwm
              Mar 20 at 0:00











            • Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

              – D. Ben Knoble
              Mar 20 at 3:48
















            I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

            – jwm
            Mar 20 at 0:00





            I was thinking the awk approach too. Should you constrain your print to lines beginning with "pass2:"? The OP didn't provide sufficient detail, but I can imagine that a naive pattern match would not be quite what was wanted.

            – jwm
            Mar 20 at 0:00













            Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

            – D. Ben Knoble
            Mar 20 at 3:48





            Python can read from standard in, though perl specializes in this kind of text processing if you’re moving into higher level scripting languages.

            – D. Ben Knoble
            Mar 20 at 3:48

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507188%2fextract-substring-according-to-regexp-with-sed-or-grep%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Masuk log Menu navigasi

            Identifying “long and narrow” polygons in with PostGISlength and width of polygonWhy postgis st_overlaps reports Qgis' “avoid intersections” generated polygon as overlapping with others?Adjusting polygons to boundary and filling holesDrawing polygons with fixed area?How to remove spikes in Polygons with PostGISDeleting sliver polygons after difference operation in QGIS?Snapping boundaries in PostGISSplit polygon into parts adding attributes based on underlying polygon in QGISSplitting overlap between polygons and assign to nearest polygon using PostGIS?Expanding polygons and clipping at midpoint?Removing Intersection of Buffers in Same Layers

            Старые Смолеговицы Содержание История | География | Демография | Достопримечательности | Примечания | НавигацияHGЯOLHGЯOL41 206 832 01641 606 406 141Административно-территориальное деление Ленинградской области«Переписная оброчная книга Водской пятины 1500 года», С. 793«Карта Ингерманландии: Ивангорода, Яма, Копорья, Нотеборга», по материалам 1676 г.«Генеральная карта провинции Ингерманландии» Э. Белинга и А. Андерсина, 1704 г., составлена по материалам 1678 г.«Географический чертёж над Ижорскою землей со своими городами» Адриана Шонбека 1705 г.Новая и достоверная всей Ингерманландии ланткарта. Грав. А. Ростовцев. СПб., 1727 г.Топографическая карта Санкт-Петербургской губернии. 5-и верстка. Шуберт. 1834 г.Описание Санкт-Петербургской губернии по уездам и станамСпецкарта западной части России Ф. Ф. Шуберта. 1844 г.Алфавитный список селений по уездам и станам С.-Петербургской губернииСписки населённых мест Российской Империи, составленные и издаваемые центральным статистическим комитетом министерства внутренних дел. XXXVII. Санкт-Петербургская губерния. По состоянию на 1862 год. СПб. 1864. С. 203Материалы по статистике народного хозяйства в С.-Петербургской губернии. Вып. IX. Частновладельческое хозяйство в Ямбургском уезде. СПб, 1888, С. 146, С. 2, 7, 54Положение о гербе муниципального образования Курское сельское поселениеСправочник истории административно-территориального деления Ленинградской области.Топографическая карта Ленинградской области, квадрат О-35-23-В (Хотыницы), 1930 г.АрхивированоАдминистративно-территориальное деление Ленинградской области. — Л., 1933, С. 27, 198АрхивированоАдминистративно-экономический справочник по Ленинградской области. — Л., 1936, с. 219АрхивированоАдминистративно-территориальное деление Ленинградской области. — Л., 1966, с. 175АрхивированоАдминистративно-территориальное деление Ленинградской области. — Лениздат, 1973, С. 180АрхивированоАдминистративно-территориальное деление Ленинградской области. — Лениздат, 1990, ISBN 5-289-00612-5, С. 38АрхивированоАдминистративно-территориальное деление Ленинградской области. — СПб., 2007, с. 60АрхивированоКоряков Юрий База данных «Этно-языковой состав населённых пунктов России». Ленинградская область.Административно-территориальное деление Ленинградской области. — СПб, 1997, ISBN 5-86153-055-6, С. 41АрхивированоКультовый комплекс Старые Смолеговицы // Электронная энциклопедия ЭрмитажаПроблемы выявления, изучения и сохранения культовых комплексов с каменными крестами: по материалам работ 2016-2017 гг. в Ленинградской области