ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I use grep <pattern> abc.* to read the files. But here grep read files in the order of 1,2,3,4 . I want to to grep the files in reverse order like 1st the abc.4 file will be read and abc.1 file will be last.
Thankyou so much for the solutions but its not working. I will try to elaborate by giving more examples.
file TOP.txt
Foul
Tall
blot
grail
House
System
Galaxy
jar
trophy
laptop
This file contains 10 words
Second file all.txt
system ns01
broad ns02
house ns03
laptop ns04
trophy ns05
ginger ns06
foul ns07
dustbin ns08
mugs ns09
blot ns10
pack ns11
butter ns12
jar ns13
knife ns14
kangroo ns15
galaxy ns16
kind ns17
heart ns18
grail ns19
short ns20
tall ns21
table ns22
chair ns23
blot ns24
onion ns25
foul ns26
this file contains 26words with their codes, now what i want to do is to relate the top file words with the codes in all.txt files omiting the words which are not present in the top file. that is i want the result to look like this
Result
Foul ns26
Tall ns21
blot ns24
grail ns19
House ns03
System ns01
Galaxy ns16
jar ns13
trophy ns05
laptop ns04
two things important firstly words are not arranged alphabetically and secondly they are not case sensitive that is similar words might be in small alphabet in top file where as in capital in all file.
I hape i have given the clear e.g. now
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.