Hi,
Suppose if i am having a file with following records as given below.
5555
6756
5555
4555
4555
6767
how can i get the count of each record using AWK.
Eg:5555 count should be 2
4555 count should be 2
6767 count should be 1
... (5 Replies)
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)
Hi,
let's say an input looks like:
A|C|C|D
A|C|I|E
A|B|I|C
A|T|I|B
as the title of the thread explains, I am trying to get something like:
1|A=4
2|C=2|B=1|T=1
3|I=3|C=1
4|D=1|E=1|C=1|B=1
i.e. a count of every character in each field (first column of output) independently, sorted... (4 Replies)
Hi,
I have a file like below
PRUM,67016800 ,CC ,C1,67016800 , ,Y,Y,2 ,CK,BX,FOX ,00000001,EA,00000001,20141120 00:00:00, ,N,Y,Y,CK ABCDEF... (7 Replies)
Hi Folks,
I have a file with fields as follows which has last field in multiple lines. I would like to combine a line which has three fields with single field line for as shown in expected output. Please help.
INPUT
hname01 windows appnamec1eda_p1, ... (5 Replies)
I am trying to remove all the lines and spaces where the count in $4 or $5 is greater than 1 (more than 1 letter). The file and the output are tab-delimited. Thank you :).
file
X 5811530 . G C NLGN4X
17 10544696 . GA G MYH3
9 96439004 . C ... (1 Reply)
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)
The below awk executes as is and produces the current output. It isvery close but what Ican not seem to do is add the -exon..., the ... portion comes from $1 and the _exon is static and will never change. If there is + sign in $4 then the ... is in acending order or sequential. If there is a - in... (2 Replies)
Hi,
Sure it's an easy one, but it drives me insane.
input ("|" separated):
1|A,B,C,A
2|A,D,D
3|A,B,B
I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1.
I am trying to get this output... (5 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 FREEBSD
watch
WATCH(8) BSD System Manager's Manual WATCH(8)NAME
watch -- snoop on another tty line
SYNOPSIS
watch [-cinotW] [-f snpdev] [tty]
DESCRIPTION
The watch utility allows the user to examine all data coming through a specified tty using the snp(4) device. If the snp(4) device is not
available, watch will attempt to load the module (snp). The watch utility writes to standard output.
The options are as follows:
-c Reconnect on close. If the tty observed by watch is closed, automatically reattach to the same tty. If this option is not speci-
fied, watch will request a new tty if running in interactive mode or exit if running without a controlling tty.
-f snpdev
If this option is specified, watch will use snpdev as the snp(4) device. Without this option, watch will attempt to find the next
available snp(4) device.
-i Force interactive mode. Interactive mode is a default if watch is started from a tty. If output is redirected to a file, interac-
tive mode can still be requested by specifying this option.
-n Disable the ability to switch the watched tty interactively. This disables both change requests made with <control-X> as well as
automatic prompting when the current tty is closed or overflows. In all cases where a prompt would be displayed, watch will exit.
The reconnect flags are unaffected by this option. When this flag is used, <control-X> is passed through to the terminal.
-o Reconnect on overflow. The behavior of watch if the observed tty overflows is similar to the behavior if the observed tty is closed.
For more info see snp(4).
-t Print the date and time when observation of a given tty is started.
-W Allow write access to observed tty.
tty Tty may be specified as a tty-style device, such as a pseudo tty device, a virtual console, or a serial line, etc. Names may be pre-
ceded by /dev/.
OPERATION
While running in interactive mode, all user input is discarded except for:
<control-G>
Exit watch.
<control-W>
Clear screen.
<control-X>
Change attached tty, unless this feature is disabled, in which case control-X is passed to the terminal as with other control charac-
ters.
SEE ALSO pty(4), sio(4), snp(4), kldload(8)HISTORY
The watch utility first appeared in FreeBSD 2.1.
AUTHORS
Ugen J.S. Antsilevich <ugen@NetVision.net.il>
BUGS
No terminal emulation is performed. All user output is reproduced as-is.
BSD November 24, 2001 BSD