awk or grep to search one column and output the other
Hello,
it would be great if someone can help me with the following:
I want to search for the rows from fileA in column 1 of fileB and output column 2 of fileB if found in fileC. In the moment I search within the complete file. How can I change the code so only column 1 is searched?
Last edited by Scott; 07-20-2013 at 04:47 AM..
Reason: Code tags
Hi,
I have a file that has many columns. Let us say "Employee_number" "Employee_name" "Salary". I want to display all entries in a column by giving all or part of the column name. For example if I input "name" I want all the employee names printed. Is it possible to do this in a simple manner... (2 Replies)
Hi friends ,
I am new to unix ,need your help to fix this
there is a ~ deliminated file. how to find the 5th column of the row.
awk 'print $5 ' abc.txt
it doesnot work . it works for table deliminated file. My data file is like the following manner.
abc.txt
--------
a~b~c~d~e~f... (3 Replies)
I have a data in a file like this
1 praveen bmscollege
2 shishira bnmit
3 parthiva geethamce
I want to search "praveen" using awk command i tried like this but i did not get
awk `$2="praveen" {print $0} ` praveen.lst
can anyone help me solving this problem in... (2 Replies)
I am trying to search a given text in a file and find its last occurrence index. The task is to append the searched index in the same file but in a separate column. I am able to accomplish the task partially and looking for a solution.
Following is the detailed description:
names_file.txt
... (17 Replies)
Hi have a large spreadsheet which has 4 columns
APM00111803814 server_2 96085 Corp IT Desktop and Apps
APM00111803814 server_2 96085 Corp IT Desktop and Apps
APM00111803814 server_2 96034 Storage Mgmt Team
APM00111803814 server_2 96152 GWP... (6 Replies)
Want to search a pattern in column
using the below command which not helpful
awk -F"\|" '$1 == '"${VAR}"' {print $1,$2}' file
how to search using "==" with variable other than the below case.
awk -F"\|" '$1 ~ /'"${VAR}"'/ {print $1,$2}' file (14 Replies)
Hello,
I have a comma seperate metadata as follows:
CITY ,COUNTY,STATE,COUNTRY
NEW_YORK,NYC ,NY ,USA
NEWARK ,ESSEX ,NJ ,USA
CHICAGO ,COOK ,IL ,USA
SEATTLE ,MINER ,WA ,USA
In my process, I get two key values ie
CITY NAME (can be one of the... (7 Replies)
I'm interested to match column pattern through awk using an external variable for data:
-9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01
-9 1:751756:T:C -9 0 T C 0.727 -5.360458e-03 9.579447e-03 7.966977e-01 5.757858e-01... (7 Replies)
Hello,
Similar question to my previous posts. I am sorry for the trouble...
Just checked my old threads but I can not implement any solution into this case..
My aim is to grab each line in fileA, check it in fileB and merge with fileC (tab separated) in corresponding line as given below:
FileA:... (2 Replies)
Discussion started by: baris35
2 Replies
LEARN ABOUT DEBIAN
cg
CG(1)CG(1)NAME
cg - Recursively grep for a pattern and store it.
SYNOPSIS
cg [ -l ] | [ [ -i ] pattern [ files ] ]
DESCRIPTION
cg does a search though text files (usually source code) recursively for a pattern, storing matches and displaying the output in a human-
readable fashion. It is intended to give some of the functionaly of AT&T's cscope(1) tool, with the advantages of simplicity and not being
language-specific. The script will colorize output if configured as such.
It is typically run with a Perl regular expression to search for. The search can be made case insensitive by using the -i option. A list
of files may also be specified with an additional argument after the pattern. Put the files pattern in quotes to make it be matched by
Perl rather than by the shell. Running the script with no arguments will recall the results of the previous search. After the search,
entries found can be edited using the vg(1) script. The -l option shows the last log made.
SOME EXAMPLES
cg - alone recalls the previous search results.
cg -i pattern - search the default list of files for all files matching the pattern (and case-insensitively).
cg pattern '*.c' - search recursively for pattern in all *.c files. This automatically converts '*' to '.*' and '.' to '.' for you and
does a Perl pattern match on all files in the tree.
cg pattern *.c - search through the shell-expanded list of *.c files, so not done recursively (in other words, only the files your shell
pass to the script as arguments).
cg -l - show the last log made.
COMMAND-LINE OPTIONS-i Do a case-insensitive search.
-l Show the last log made.
-p Toggle the default pager option. cg has a bulit-in pager function, which can be enabled or disabled by default (in .cgvgrc). If the
default is enabled, this option disables the pager; if the default is disabled, this option enables it.
-P Force the built-in pager to be disabled.
FILES
${HOME}/.cglast
Log file of the last search.
${HOME}/.cgvgrc
Per-user configuration file (if the defaults are not desireable).
${HOME}/.cgvg/*
Log files in $HOSTNAME.shell_pid form with the log of the last search.
SEE ALSO vg(1), perl(1), find(1), grep(1), cscope(1)AUTHOR
cg was written by Joshua Uziel <uzi@uzix.org>.
13 Mar 2002 CG(1)