Hi everybody,
I'm trying to replace the $98 field with "T" if the last field (108th) is T
I've tried
awk 'BEGIN{OFS=FS="|"} {if ($108=="T")sub($98,"T"); print}' test.txt
but that doesn't do anything
also tried
awk 'BEGIN{OFS=FS="|"}{ /*T.$/ sub($98,"T")} { print}' test.txt
but... (2 Replies)
If $1 in file1 matches $2 in file2. Then the value in $2 of file2 is updated to $1"."$2 of file2. The awk seems to only match the two files but not update. Thank you :).
awk
awk 'NR==FNR{A ; next} $1 in A { $2 = a }1' file1 file2
file1
name version
NM_000593 5
NM_001257406... (3 Replies)
I am trying to use awk to match two files that are tab-delimited. When a match is found between file1 $1 and file2 $4, $4 in file2 is updated using the $2 value in file1. If no match is found then the next line is processed. Thank you :).
file1
uc001bwr.3 ADC
uc001bws.3 ADC... (4 Replies)
In the tab-delimeted input file below I am trying to use awk to update the value in $2 if TYPE=ins in bold, by adding the value of
HRUN= in italics. In the below since in line 1 TYPE=ins the 117282541 value in $2 has 6 added because that is the value of HRUN=.
Hopefully the awk is a start but I... (2 Replies)
In the perl below I am trying to set/update the value of $14 (last field) in file2, using the matching NM_ in $12
or $9 in file2 with the NM_ in $2 of file1.
The lengths of $9 and $12 can be variable but what is consistent is the start pattern will always be NM_ and the end pattern is always
;... (4 Replies)
In the perl below, which does execute, I am having trouble with the else in Rule 3. The digit in f{8} is extracted and used to update f accordinly along with the value in f.
There can be either - * or + before the number that is extracted but the same logic applies, that is if the value is greater... (5 Replies)
In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
I have an input file with
A=xyz
B=pqr
I would want the value in Second Field (xyz or pqr) updated with a value present in Shell Variable based on the value passed in the first field. (A or B )
while read line
do
NEW_VALUE = `some functionality done on $line`
If $line=First Field-... (1 Reply)
Request your help to change the field color based on condition , if it is otherthan 0. using html in unix.
Here is my condition
for(i=1;i<=NF;i++)
{
print "<td> "$i"</td>
}
Please use CODE tags when displaying sample input, output, and code segments. (17 Replies)
Hi,
So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
LEARN ABOUT LINUX
updatedb
updatedb(8) System Manager's Manual updatedb(8)NAME
updatedb - update a database for mlocate
SYNOPSIS
updatedb [OPTION]...
DESCRIPTION
updatedb creates or updates a database used by locate(1). If the database already exists, its data is reused to avoid rereading directo-
ries that have not changed.
updatedb is usually run daily by cron(8) to update the default database.
EXIT STATUS
updatedb returns with exit status 0 on success, 1 on error.
OPTIONS
The PRUNE_BIND_MOUNTS, PRUNEFS, PRUNENAMES and PRUNEPATHS variables, which are modified by some of the options, are documented in detail in
updatedb.conf(5).
-f, --add-prunefs FS
Add entries in white-space-separated list FS to PRUNEFS.
-n, --add-prunenames NAMES
Add entries in white-space-separated list NAMES to PRUNENAMES.
-e, --add-prunepaths PATHS
Add entries in white-space-separated list PATHS to PRUNEPATHS.
-U, --database-root PATH
Store only results of scanning the file system subtree rooted at PATH to the generated database. The whole file system is scanned
by default.
locate(1) outputs entries as absolute path names which don't contain symbolic links, regardless of the form of PATH.
--debug-pruning
Write debugging information about pruning decisions to standard error output.
-h, --help
Write a summary of the available options to standard output and exit successfully.
-o, --output FILE
Write the database to FILE instead of using the default database.
--prune-bind-mounts FLAG
Set PRUNE_BIND_MOUNTS to FLAG, overriding the configuration file.
--prunefs FS
Set PRUNEFS to FS, overriding the configuration file.
--prunenames NAMES
Set PRUNENAMES to NAMES, overriding the configuration file.
--prunepaths PATHS
Set PRUNEPATHS to PATHS, overriding the configuration file.
-l, --require-visibility FLAG
Set the "require file visibility before reporting it" flag in the generated database to FLAG.
If FLAG is 0 or no, or if the database file is readable by "others" or it is not owned by mlocate, locate(1) outputs the database
entries even if the user running locate(1) could not have read the directory necessary to find out the file described by the data-
base entry.
If FLAG is 1 or yes (the default), locate(1) checks the permissions of parent directories of each entry before reporting it to the
invoking user. To make the file existence truly hidden from other users, the database group is set to mlocate and the database per-
missions prohibit reading the database by users using other means than locate(1), which is set-gid mlocate.
Note that the visibility flag is checked only if the database is owned by mlocate and it is not readable by "others".
-v, --verbose
Output path names of files to standard output, as soon as they are found.
-V, --version
Write information about the version and licence of locate on standard output and exit successfully.
EXAMPLES
To create a private mlocate database as an user other than root, run
updatedb -l 0 -o db_file -U source_directory
Note that all users that can read db_file can get the complete list of files in the subtree of source_directory.
FILES
/etc/updatedb.conf
A configuration file. See updatedb.conf(5).
/var/lib/mlocate/mlocate.db
The database updated by default.
SECURITY
Databases built with --require-visibility no allow users to find names of files and directories of other users, which they would not other-
wise be able to do.
NOTES
The accompanying locate(1) utility was designed to be compatible to slocate and attempts to be compatible to GNU locate where possible.
This is not the case for updatedb.
AUTHOR
Miloslav Trmac <mitr@redhat.com>
SEE ALSO locate(1), mlocate.db(5), updatedb.conf(5)mlocate Jun 2008 updatedb(8)