Hi,
I have a various files;each filled with hundreds of line with similar number of fields.
I would like to extract out field $5 from each of this file and aggregate them before printing out to a file.
I tried to :-
#!/usr/bin/awk -f
file="file1.txt file2.txt file3.txt file4.txt"
... (1 Reply)
Hi All,
I have a string like below:
str="Hold=True Map=False 'This will map the data' Run=Yes Modify=False"
I want to print the field Run=Yes and retrive the value "Yes". I cannot use simple awk command because the position of the "Run" will be different at different times. Is there a way... (6 Replies)
Hi,
I'm trying to print every line from first field to the fourth from a file containing more.
$ cat input
a b c d e f g
a b c d e f gI'm trying
awk '{for (i=1; i <= NF-3; i++) print $i}' awkTest.datbut it printsa
b
c
d
a
b
c
dSo, I easily guess I'm wrong. :)
Of course, I want:a b... (5 Replies)
894344202808090;11122;040320 075858 166;101;0;0;10u;0;NA;65;221890;2;101973;185059;568674;Y; PRE;0;0;NA;NA;0;NA;0;NA;textmsg;textmsg_snd1;telusmob;TEXTMSG1;0.15000000;126037;2010/03/04 12:58:57gmt;0;70532192;
plz tell me any awk command
which on the basis of the yellow field which is... (1 Reply)
I would like to print the number of records of 2 files, and divide the two numbers
awk '{print NR}' file1 > output1
awk '{print NR}' file2 > output2
paste output1 output2 > output
awl '{print $1/$2}' output > output_2
is there a faster way? (8 Replies)
Hi,
I have below text file
01.02.2014,asdas,arse,aere,4tfsd
12.03.2014,sdte,45gf,8iuj,qw343w
01.02.0214,aetre,sdfgter,asfrwe
I have writen below code to print only first field that is only date field from text file
#!/bin/ksh
echo "enter week"
read week
while read -r... (6 Replies)
I want to print line by line only the first field from txt file
input file
etr,t7tu,e45xdt,e45exgt,cdgfe
aqw34aw,45edgf,45estd,sert34
a232e,4etedf,w345er,qw345rw,
qw354,q34asf,tw45f,q3drsf
required o/p file
etr
aqw34aw
a232e
qw354 (1 Reply)
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
Hi
I have attached txt file as input,
and i'm able to calculate sum of columns at the end but the format of sum is not coming up right.
awk -F"," '{for (i=4;i<=NF;i++) sum+=$i}{print}; END { sum="Total:"; for (i=1;i<=NF;i++) {printf sum ","} print "\n"}' input.txt
check the o/p file, at... (6 Replies)
Discussion started by: manas_ranjan
6 Replies
LEARN ABOUT NETBSD
lastlogin
LASTLOGIN(8) BSD System Manager's Manual LASTLOGIN(8)NAME
lastlogin -- indicate last login time of users
SYNOPSIS
lastlogin [-nrt] [-f filename] [-H hostsize] [-L linesize] [-N namesize] [user ...]
DESCRIPTION
lastlogin will list the last login session of specified users, or for all users by default. Each line of output contains the user name, the
tty from which the session was conducted, any hostname, and the start time for the session.
If multiple users are given, the session information for each user is printed in the order given on the command line. Otherwise, information
for all users is printed, sorted by uid.
lastlogin differs from last(1) in that it only prints information regarding the very last login session. The last login database is never
turned over or deleted in standard usage.
The following options are available:
-f filename
Process input from filename. If the file ends with an ``x'', then it is assumed that it is a lastlogx(5) file, else it is assumed to
be a lastlog(5) file.
-H hostlen
Set the field width for host output to hostlen characters.
-L linelen
Set the field width for line output to linelen characters.
-N namelen
Set the field width for name output to namelen characters.
-n Attempt to print numeric host addresses. This option is only supported with lastlogx(5) format files.
-r Reverse the order of the sort.
-t Sort by last login time (most recent first.)
FILES
/var/log/lastlogx default last login database
/var/log/lastlog compatibility last login database
EXAMPLES
lastlogin looks by default to the /var/log/lastlogx database, where some old programs that are not utmpx(5) aware might only write to
/var/log/lastlog. To look at the old database one can use:
lastlogin -f /var/log/lastlog
SEE ALSO last(1), lastlog(5), lastlogx(5), ac(8)AUTHORS
John M. Vinopal wrote this program in January 1996 and contributed it to the NetBSD project.
BSD March 4, 2005 BSD