Sponsored Content
Top Forums Shell Programming and Scripting Find matches and write the data before it Post 302727799 by Priyanka Chopra on Wednesday 7th of November 2012 12:30:49 AM
Old 11-07-2012
Find matches and write the data before it

Hi all

I am here for help once again

I have two files

One file is like this with one columns

Code:
F2
B2
CAD
KGM
HTC
CSP


Second file is like this in 5 columns where firs column contain sometime entries of first file with space and other entries


Code:
F2 XYZ CDT CAD          it is part of agriculture    it is part of university   it is part of ...             it is used for.... 

KGM HTC CSP      it is part of agriculture    it is part of university   it is part of ...             it is used for....

If there is a match then I have to separate like this in 5 columns

Code:
F2  it is part of agriculture    it is part of university   it is part of ...             it is used for.... 
CAD  it is part of agriculture    it is part of university   it is part of ...             it is used for.... 


KGM it is part of agriculture    it is part of university   it is part of ...             it is used for.... 

HTC  it is part of agriculture    it is part of university   it is part of ...             it is used for.... 

CSP  it is part of agriculture    it is part of university   it is part of ...             it is used for....

please help me out
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extarcting data from a file that matches two different patterns

Say I have data like shown below. I want all the data that contains XXXX and where it finds XXXX then I also want the Timestamp and the Error fields. I have tried egrep "XXXX|Timestamp" > test.txt. That pulls out the data correctly but gives me two records for each message and it also pulls the... (4 Replies)
Discussion started by: gugs
4 Replies

2. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

3. Shell Programming and Scripting

find matches in file

Hi, im have log file ~100000 lines, 192.168.29.1 at 10/08/09 13:58:55 192.168.60.1 at 10/08/09 14:11:28 192.168.58.171 at 10/08/09 14:12:45 192.168.61.12 at 10/08/09 14:15:44 192.168.60.1 at 10/08/09 14:16:36 192.168.60.1 at 10/08/09 14:17:43 192.168.61.12 at 10/08/09 14:18:08... (9 Replies)
Discussion started by: Trump
9 Replies

4. Shell Programming and Scripting

find/grep returns no matches

Hi all! I've faced with very unintelligible error using find/grep like this: root@v29221:~# find /var/www/igor/data/www/lestnitsa.ru | grep u28507I get nothing as a result, but: root@v29221:~# grep u28507 /var/www/igor/data/www/lestnitsa.ru/_var.inc $db_name = 'u28507';... (2 Replies)
Discussion started by: ulrith
2 Replies

5. Shell Programming and Scripting

Find directories that contains more than n matches of a certain filename

I need to construct a command that finds directories which contains more than n matches of a certain filename. E.g. I have many directories at different locations and want to find all directories that has 2 or more .dat-files. I thought of using find and maybe the exec parameter to issue an... (5 Replies)
Discussion started by: odyssey
5 Replies

6. Homework & Coursework Questions

Shell script calling Perl function, sort and find data, write to new files

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I must write a shell script that calls two external Perl functions--one of which sorts the data in a file, and... (6 Replies)
Discussion started by: kowit010
6 Replies

7. Shell Programming and Scripting

zgrep cannot find all matches

$ cat 1.csv abc in csv $ cat 1.mnf abc in mnf $ zip 1.zip 1.csv 1.mnf adding: 1.csv (stored 0%) adding: 1.mnf (stored 0%) $ zgrep abc 1.zip abc in csv How come zgrep cannot find "abc in mnf"? Thanks in advance. (5 Replies)
Discussion started by: carloszhang
5 Replies

8. Shell Programming and Scripting

Find common entries in 2 list and write data before it

Hi all, I have 2 files: second file I want if entries in one file will match in other file. It shuld wite approve before it so output shuld be (1 Reply)
Discussion started by: manigrover
1 Replies

9. Shell Programming and Scripting

Find Data in test file and write each out to a line

I have a .csv file that has been create from a google form and I need to extract the data from it that has been entered by users. The CSV will have anywhere between 100 and 1000 lines which comprise entr data for a sports carnival A few typical line is shown here to show the problem I have ... (19 Replies)
Discussion started by: kcpoole
19 Replies

10. Shell Programming and Scripting

Find a text and if condition matches then replace it

Need a script that can find text in a file and replace it accordingly. This is the file I have: while IFS=',' read -r f1 f2 f3 do { nohup /home/testuser/dbmaintenance/sys_offline_maintenance.sh $f1 $f2 $f3 > $f2.out & } done < "/home/testuser/dbmaintenance/week1offlineserver.txt" In... (4 Replies)
Discussion started by: singhhe
4 Replies
zlacpy.f(3)							      LAPACK							       zlacpy.f(3)

NAME
zlacpy.f - SYNOPSIS
Functions/Subroutines subroutine zlacpy (UPLO, M, N, A, LDA, B, LDB) ZLACPY copies all or part of one two-dimensional array to another. Function/Subroutine Documentation subroutine zlacpy (characterUPLO, integerM, integerN, complex*16, dimension( lda, * )A, integerLDA, complex*16, dimension( ldb, * )B, integerLDB) ZLACPY copies all or part of one two-dimensional array to another. Purpose: ZLACPY copies all or part of a two-dimensional matrix A to another matrix B. Parameters: UPLO UPLO is CHARACTER*1 Specifies the part of the matrix A to be copied to B. = 'U': Upper triangular part = 'L': Lower triangular part Otherwise: All of the matrix A M M is INTEGER The number of rows of the matrix A. M >= 0. N N is INTEGER The number of columns of the matrix A. N >= 0. A A is COMPLEX*16 array, dimension (LDA,N) The m by n matrix A. If UPLO = 'U', only the upper trapezium is accessed; if UPLO = 'L', only the lower trapezium is accessed. LDA LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M). B B is COMPLEX*16 array, dimension (LDB,N) On exit, B = A in the locations specified by UPLO. LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(1,M). Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 104 of file zlacpy.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 zlacpy.f(3)
All times are GMT -4. The time now is 05:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy