Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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 did indeed - thanks for the corrective feed-back :}
A more complex solution that doesn't sort the results be easily accomplished
using awk (it's non-deterministic, though):
[code]
awk '{entries[$0]=$0} END{ for (i in entries) print entries[i]}' file1 file2 > file3
[code]
and file2 ->
101-140674-200612-9000408789
101-140675-200612-9000402900
101-140676-200612-9000402830
101-140677-200612-9000402906
101-140678-200612-9000408038
101-140679-200612-9000402855
202-248385-200612-9000161331
202-248386-200611-9000066570
202-248386-200611-9000066571
202-248386-200612-9000161314
202-248386-200612-9000411349
202-248387-200611-9000075961
202-248387-200612-9000161303
202-248388-200611-9000076355
202-248388-200612-9000161316
I would like to make a file3, wich will have all lines from file 1 but only if that lines are not in file 2
Is something like that possibile to do from the bash or i need some programing language ?
I have done this by now :
-----------------------------------------------------------
#!/bin/bash
unixfiles=` cat /program/unixfiles.txt`
files=` cat /program/files.txt`
for i in $unixfiles; do
echo $i
for fa in $files; do
echo "UN, $fa"
if [ "$i" = "$fa" ]; then
echo "same" >> /program/state.txt
else
# cat "$fa" >> /program/samefiles.txt
echo "not same" 1>> /program/state.txt
fi
done
done
exit
------------------------------------------------------------
I think that it is working but i don't know why i cant use
cat "$fa" >> /program/samefiles.txt
if i use that comand then i get some error message !
Does somebody know why ???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.