General :: Cross Reference Matching Between Files?

Oct 18, 2009

I'm trying to do something very basic in bash. It's a kind of cross-reference matching between 2 files. I have a file1.txt. It's like this:

Code:

item1
item3
item4
...

I Have a file2.txt. It's like this:

Code:

item1 "Properties of item1"
item2 "Properties of item2"
item3 "Properties of item3"
item4 "Properties of item4"
item5 "Properties of item5"
...

My goal is to print out the lines in file2 that contains lines present in file1. I do:

Code:

for i in $(cat file1.txt); do grep $i file2.txt; done but I get no output. Will someone please tell me where am I mistaking?

View 3 Replies


ADVERTISEMENT

General :: Operating System Command Cross Reference Site?

Oct 18, 2010

Does anyone know of a decent Operating System CLI cross reference website where I can compare diffent CLI commands against others? For example I have a MAC OS 10.6X running Darwin and I needed to know what the equivalent command using CentOS of rusers would be? It would be users running that same command at the MAC cli.

View 3 Replies View Related

General :: Listing Files Using Pattern Matching

Mar 13, 2011

I have a requirement to list files using find command My folder contains below list of files with out extention.I have a requirement to exclude only ABC.123.* type files and list others. Even though files having MNO contains this pattern i should not exclude. Even if file ends with .txt or .doc it should not be excluded. That is ABC.123.1234.txt should not be excluded.But I am not getting what is required. Can any one please let me know if I am doing wrong any where. As per my requirement I cannot use grep, -regex, or -regex attributes to find command.

View 7 Replies View Related

General :: Delete Matching Files In All Subdirectories?

Feb 22, 2010

How can I remove all .swp files in all of my subdirectories under Linux?

View 4 Replies View Related

General :: Copy All Files Matching Pattern From SRC To DST

Jul 19, 2011

If I wanted to copy all *.so files from src to dst I'd do:
cp src/*.so dst
However, I want to copy all *.so files from src and it's subdirs into dst.

View 2 Replies View Related

General :: How To Get List Of Files Not Matching Patterns In Bash

May 4, 2011

I have a file with joker character patterns:
./include/*
./src/*
etc.
From the current directory I would like to recursively get the list of files that do not match these patterns.

View 2 Replies View Related

General :: Copy Wildcard Files From Directories For Matching

Feb 11, 2011

I have 2 massive duplicate dirs of the same format as below:
dir1
subdir1
file1
subdir2
file1
subdir3
file1
...

Dir2 is the same, but it has some newer files of the same name. I want to copy all file1's from Dir2 to the same name and folders in dir1. So basically something like:
cp -pr bkpDir1/*/*-big.gif Dir2/*/*-big.gif

This works for singular cases:
cp -pr bkpDir1/uniquesubdir/*-big.gif Dir2/uniquesubdir/*-big.gif

But not for wildcards:
cp -pr bkpDir1/subdir*/*-big.gif Dir2/subdir*/*-big.gif

Anyway the aim is to do the first cp above, I have tried a few options using find. In trying to show an example stumbled upon a way that worked, while in dir2:
find */*-big.gif | xargs -i cp -rp {} ../dir1/{}
Sure there are better ways also...

View 1 Replies View Related

General :: Recursive Searching Files In Directory Matching Given Name?

Apr 16, 2010

I am writing a shell script that finds all files named <myFile> in a directory <dir> or any of its subdirectories, recursively. I also need to take care of symbolic links that may form cycles, to avoid infinite loops. I am not supposed to use find command for the same

I started writing the code but got stuck. I thought using recursion may be a smart way, but its not working.

Code:
#!/bin/sh
findFiles()
{
thisDIR=$1
#cd $thisDIR
code....

View 5 Replies View Related

General :: Printing Matching Lines When Greping All Files In A Directory

Apr 3, 2010

I'm searching within Java files for some occurrence of a phrase:

find . -name '*.java' | xargs grep -l 'string'

How do I change this command to print to the shell all of the lines which contain a match?

View 4 Replies View Related

General :: Compare Directory Structure Without Matching Data In Files

Jul 22, 2010

What is the best and simplest way to compare two directory structures without actually comparing the data in files. This works fine:
diff -qr dir1 dir2
But it's really slow because it's comparing files too. Is there a switch for diff or another simple cli tool to do this?

View 4 Replies View Related

General :: List Files Based On Matching Only Part Of Their Filename?

Sep 13, 2011

I have many files in a folder for example

Kiran.txt
Kiran1.txt
Kiran221.txt
Kiran144.txt
Time.csv

[Code]...

From this directory, I want to know how I could use grep to display files based on part of their filename - for example those starting with "Account" or those ending in ".sh".

View 4 Replies View Related

General :: Find/grep/wc Command To Find Matching Files - Print Filename And Word Count?

Sep 11, 2009

I am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:

wc `find . ( -name "*.as" -o -name "*.mxml" ) -exec grep -H HeightResizableList {}` ;

View 10 Replies View Related

Programming :: Matching Two Tables Of Non-matching Sizes?

Mar 2, 2011

I have two table files with x (1st column) ,y (2nd column) coordinates and intensity (3rd column). I need to match these two tables and divide the intensities at the consecutive coordinates on the 3rd column. The problem is the size of the tables are not same and I want to ignore the lines if they are not in one of the other file.

Here is Table 1:

Code:
-7.500-30.00013.006
-7.500-22.50037.952
-7.500-15.00060.962
-7.500-7.50040.922
-7.5000.00014.348
code....

View 3 Replies View Related

Programming :: Rename Files Matching A List?

Jul 12, 2009

Is there a way, preferably in python or BASH, to rename files from a list? for instance, track1.mp3, track2.mp3 should be renamed to the names stored in a file listing song names. I have tried to loop a variable through directory listing and renamed them, only to find that filenames with spaces can't be assigned to a variable as a whole. To solve the problem above, I have tried the read command in BASH, which enables the program reading line by line from a list. However, It was failed to pipe the results from directory listing to the read command.

View 14 Replies View Related

Programming :: AWK (or TCL/TK): Matching Rows And Columns Between Multiple Files?

May 26, 2011

I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:

file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9

[code]...

View 6 Replies View Related

Programming :: Using Header Files - Reference And Put Formulas?

Feb 14, 2011

New to programming having issues reference header files.

Not sure how to put the fomula in headers below:

Program

using namespace std;

View 7 Replies View Related

Software :: Finding (conditions) Then Create Tar-ball (matching Files)?

Jul 8, 2010

certain there is command line magic that will enable me touse find to identify a set of files use tar to create an archive of all matching files I get find to create a list of files that I really want, but I'm dashed if I can discover how to tell tar to roll-up all of those files.

If I use find's -exec option, it runs tar for each filename. Telling tar that input is $(find ...) results in a command line that is correct but too long. I think that I want to tell tar to read the list of files from STDIN, but I cannot discover how to do that if it is possible. I thought that the option "--" double-dash but having that right-most on the tar command did not work.

View 5 Replies View Related

Fedora :: Error - C Header Files Matching Your Running Kernel Were Not Found

Jun 29, 2010

I need to install VMWare Workstation on Fedora 13, but I keep running into the following error -

"C header files matching your running kernel were not found...."

It's looking for 2.6.33.3-85.fc13.i686 but when I did a - yum install kernel-devel I got 2.6.33.5-124.fc13.i686

when I do - yum install kernel-devel `uname -r`

I get the following -

Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Package kernel-devel-2.6.33.5-124.fc13.i686 already installed and latest version

[code]....

View 5 Replies View Related

Ubuntu Security :: Is There Way To Make Cross-platform Hidden Files?

Oct 24, 2010

I'm sure most of you know that making a file or folder hidden is simple in the Linux world: Add a period (.) before the name. However, if you were to save such a file or directory to a flash drive, it would only be hidden on Linux systems. If you plug the flash drive into a Windows machine, Windows will happily show the file.Is there a way to make cross-platform hidden files?

View 4 Replies View Related

Programming :: Linking Object Files With Geany On Ubuntu - Undefined Reference To Class::functionName

Mar 9, 2009

I have created a simple test class - Mortgage, with the class declaration in the .h file and the class's methods defined in the .cpp file. (mortgage.h && mortgage.cpp, respectively) Straight up C++ 101 as far as I can tell. I instantiate the class in the main() function, which is defined in practice.cpp. Using Geany on Ubuntu, both the practice.o and mortgage.o files are created, but then I get a linker error: undefined reference to class::functionName

I get it for each function. If the mortgage.cpp file is foremost in the editor when I click "build", then I get the undefined reference to main() error, if practice.cpp is foremost (where the main() function is) then I get undefined reference to Mortgage::Mortgage(), and all the rest of the functions defined for that class. How do I get the linker to know where my object files are so it will link them in? Or is the problem somewhere else entirely?

View 8 Replies View Related

General :: Use Awk To Matching In Only A Specific Column?

Jul 12, 2010

Im trying to use awk to do matching in only a specific column

example.txt:
www.google.com www.example.com
www.google.com/search www.example2.com
i used:
awk '{ (if $1 == "http://www.google.com") print $2}' example.txt

this awk statement only returns the first line, and i cant seems to make it perform in a way to match based on keywords like GREP. Is there any way to make display the other lines which contains "google" also?

View 1 Replies View Related

General :: How To Rename Everything Matching Certain String In Folder

May 19, 2010

I am running Linux and I have some basic console knowledge but my current problem is quite difficult and I dont know how to achieve this. I want/need to rename everything within a folder that matches a given string.

By everything I mean:
folders/files
content within a file
content in hidden files

Basically I want to refactor a Java-project. Sure, I could use Eclipse to handle the replacing, but this leaves out the folders or resources outside of my workspace. I was thinking of a script that could do the job for me but this seems rather tricky. For instance when it comes to folder-/file-rename I want to replace only the part of the name that matches my string, the rest should remain untouched.

View 2 Replies View Related

General :: Grep Or Sed To Delete Matching Pattern?

Jul 7, 2011

How can I use grep -Ev "pattern" not only to delete the matching "pattern" but to edit and save the file permanently as well

View 2 Replies View Related

General :: Boot Menu Not Matching Grub.cfg?

Feb 1, 2011

I had debian squeeze already installed, then installed win 7. Windows overwrote by MBR, as I expected it to, so I used an ubuntu live cd to reinstall grub2 to debian root.

I rebooted, and sure enough I had grub back. The boot menu has debian on it. Just debian (crunchbang actually, but its the same thing).

So I added a script in /etc/grub.d (called Windows_11) to create a windows chainloader entry in grub.cfg, and ran update-grub.

Update-grub picks up my /etc/grub.d/Windows_11 script, and adds an appropriate chainloader entry to /boot/grub/grub.cfg.

So I would expect this new chainloader entry to show up in my boot menu when I boot up. But it doesn't; on booting I only have the option to select debian.

Here is my /boot/grub/grub.cfg -

Code:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'CrunchBang Linux, with Linux 2.6.32-5-686' --class crunchbang --class gnu-linux --class gnu --class os {
insmod part_msdos

[Code].....

View 11 Replies View Related

General :: Undefined Reference To `__libc_csu_fini'?

Dec 9, 2010

I am getting the bellow linker error with GCC 4.4 and GLIBC 2.12.

1. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x12): undefined reference to `__libc_csu_fini'
2. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x19): undefined reference to `__libc_csu_init'

View 7 Replies View Related

General :: Undefined Reference To `rand_'?

May 21, 2011

When I am trying to compile the code in this linkI get the following error:

fmech_subs.o: In function `focalmc_':
fort77-3595-1.c.text+0xa9f): undefined reference to `rand_'
collect2: ld returned 1 exit status

[code]....

View 2 Replies View Related

General :: Undefined Reference To `SHA256_Update'

Jan 25, 2011

I get this error : debug/libns3.so: undefined reference to `SHA256_Update' debug/libns3.so: undefined reference to `SHA256_Final' debug/libns3.so: undefined reference to `SHA256_Init' collect2: ld returned 1 exit status

View 1 Replies View Related

General :: Remove A Folder : Getting An Error : Unexpected EOF While Looking For Matching?

Apr 8, 2011

I tried to remove a folder in linux, davidanderson'spetshop_617 as a folder name. It contained a single quotes. By using the following command

rm -r path/davidanderson'spetshop_617

I am getting this error ,Error: unexpected EOF while looking for matching `''unexpected end of files.How can i remove the folder?

View 2 Replies View Related

General :: File Matching Pattern On Command Line?

Sep 9, 2011

I've got files in a directory as follows:

1.png
1_thumb.png
1-1.png
1-1_thumb.png

[code]....

I want to list all the files that don't have a copy with the same filename with -1 somewhere in it. So, in the example above, the results would be 3.png.

NB: the file and its copy with "-1" in it will be the same filesize, if that helps.

View 2 Replies View Related

General :: Removing A Root Reference In Subdirectory?

Jun 4, 2010

While saving a file I made a typo and performed the vi command ':w~' instead of ':w!' and I created a root '~' instance in one of my subdirectories. How do I remove this reference without wiping out the entire main /root /~ directory? Do I use unlink()?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved