Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have used diff command in past.I faced a situation to which I did not had a clue here are some text strings (which can be stored in a file)

CONFIG_XEN=y
CONFIG_XEN_PVHVM=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=128
CONFIG_XEN_SAVE_RESTORE=y
CONFIG_XEN_DEBUG_FS=y
CONFIG_SWIOTLB_XEN=y
CONFIG_MICROCODE_XEN=y
CONFIG_XEN_DOM0=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_DOM0_PCI=y
CONFIG_XEN_PCI_PASSTHROUGH=y
CONFIG_PCI_XEN=y
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_NETXEN_NIC=m
CONFIG_XEN_NETDEV_FRONTEND=m
CONFIG_XEN_KBDDEV_FRONTEND=y
CONFIG_HVC_XEN=y
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_XEN_BALLOON=y
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XEN_BACKEND=y
CONFIG_XEN_NETDEV_BACKEND=m
CONFIG_XEN_BLKDEV_BACKEND=m
CONFIG_XEN_BLKDEV_TAP=m
CONFIG_XEN_BLKBACK_PAGEMAP=m
CONFIG_XEN_PCIDEV_BACKEND=m
CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
CONFIG_XENFS=y
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_MCE=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_S3=y
CONFIG_ACPI_PROCESSOR_XEN=y
CONFIG_XEN_PLATFORM_PCI=m

I have to basically find above strings only (not any other) in a .config file of kernel which looks as follows

http://pastebin.com/AEQ6p9Vm It is a very big file.

Now I had no clue if by commands I can find the entries I first mentioned whether exist in second file or not so I did manually copied each entry and searched in the .config I mentioned.I found

there are following differences

 # CONFIG_XEN_DEBUG_FS is not set CONFIG_XEN_BLKBACK_PAGEMAP <--- is
 completely missing
 # CONFIG_XEN_NETDEV_BACKEND is not set
 # CONFIG_XEN_BLKDEV_BACKEND is not set
 # CONFIG_XEN_BLKDEV_TAP is not set CONFIG_XENFS=y
 # CONFIG_XEN_GNTDEV is not set

Can this be easily done by find grep or some thing similar?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

This will show the lines in the big file which match the lines in the list.

grep -Ff string-list-file very-big-file
share|improve this answer
    
thanks a lot. –  Registered User Mar 2 '11 at 20:14

First, sort your two files.

sort list > list-sorted
sort config > config-sorted

To see the lines that are in your list and in your config file, run

comm -1 -2 list-sorted config-sorted

To see the lines in your list that are not in your config file, run

comm -2 -3 list-sorted config-sorted

share|improve this answer
    
thanks a lot for this tip.You saved my day. –  Registered User Mar 2 '11 at 20:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.