05-01-2001
Hello,
Im trying to extract a portion of a big file.
Using unique pattern /occurrence ,
(ex. loginname1,logoff and loginname2,logoff ),
I like to print the lines that contain the patterns and the lines between them.
Also, create a file for every login occurrence.
Thanks for everyone's help. Good day.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file of the following format.
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user... (5 Replies)
Discussion started by: nua7
5 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
I'm new in the unix environment. I'm having a challenge in extracting data from a flat file and convert it to a CSV file format or I should be able to open it with MS Excel.
The input data in my flat file looks like this:
AV00001001155000063637143326711145412082EM SITHOLE... (3 Replies)
Discussion started by: Mthimbana
3 Replies
3. Shell Programming and Scripting
Hi All,
I have a requirement where I have to search the file with some text say "Exception". This exception word can be repeated for more then 10 times.
Suppose the "Exception" word is repeated at line numbers say x=10, 50, 60, 120. Now I want to extract all the lines starting from x-5 to... (3 Replies)
Discussion started by: rrangaraju
3 Replies
4. Shell Programming and Scripting
I have an of xml file as shown below
<?xml version='1.0' encoding='ASCII' standalone='yes' ?>
<Station Index="10264" >
<Number Value="237895890" />
<Position Lat="-29.5" Lon="3.5" />
<MaxDepth Value="-4939" />
<VeloLines Count="24">
<VeloLine Index="0" >
<Depth... (3 Replies)
Discussion started by: shashi792
3 Replies
5. Shell Programming and Scripting
Hello everybody,
Here is my problem : I cannot find a way to extract data from a particular file and more precisely I cannot extract the result of my awk script to an external file because I am currently working on HP-UX.
I would like a simple script (without awk) which asks for a date like... (4 Replies)
Discussion started by: freyr
4 Replies
6. Shell Programming and Scripting
Hi,
I have three files as below:
AA.DAT20110505063903.Z
AA.DAT20110405062903.Z
AA.DAT20110305061903.Z
All the above files are appended with Date and timestamp in compressed format.
I need to extract AA.DAT20110505063903.Z(which is the latest file) from one server and uncompress it... (2 Replies)
Discussion started by: pyaranoid
2 Replies
7. Shell Programming and Scripting
I need to extract some content of a file.
Example
file abc
vi abc
ooooooooo
bbbbbbbbb
vvv 1234 5
vvv 6789 3
xxxxxxxxxx
xxxxxxxxxx
i want to extract only the following content from file abc and store in another file say temp.
1234 5
6789 3
what should be my approach? (2 Replies)
Discussion started by: priya_ag04
2 Replies
8. Shell Programming and Scripting
Hi Freinds,
I have a file1.txt in the following format
File1.txt
I want to get 2 files from the above file filextra.txt should have the lines which are ending with "<" and remaining lines in the filecompare.txt file.
Please help. (3 Replies)
Discussion started by: i150371485
3 Replies
9. Shell Programming and Scripting
FILE_ID extraction from file name and save it in CSV file after looping through each folders
My files are located in UNIX Server, i want to extract file_id and file_name from each file .and save it in a CSV file. How do I do that?
I have folders in unix environment, directory structure is... (15 Replies)
Discussion started by: princetd001
15 Replies
10. Shell Programming and Scripting
Hello,
I'm attempting to extract 13 digit numbers beginning with 978 from a data file with the following command:
awk '{ for(i=1;i<=NF;i++) if($i ~ /^978/) print $i; }' datafile > outfile
This typically works. However, the new data file is an .xml file, and this command is no longer working... (6 Replies)
Discussion started by: palex
6 Replies
LEARN ABOUT OPENSOLARIS
acctcon
acctcon(1M) System Administration Commands acctcon(1M)
NAME
acctcon, acctcon1, acctcon2 - connect-time accounting
SYNOPSIS
/usr/lib/acct/acctcon [-l lineuse] [-o reboot]
/usr/lib/acct/acctcon1 [-p] [-t] [-l lineuse] [-o reboot]
/usr/lib/acct/acctcon2
DESCRIPTION
acctcon converts a sequence of login/logoff records to total accounting records (see the tacct format in acct.h(3HEAD)). The login/logoff
records are read from standard input. The file /var/adm/wtmpx is usually the source of the login/logoff records; however, because it might
contain corrupted records or system date changes, it should first be fixed using wtmpfix. The fixed version of file /var/adm/wtmpx can then
be redirected to acctcon. The tacct records are written to standard output.
acctcon is a combination of the programs acctcon1 and acctcon2. acctcon1 converts login/logoff records, taken from the fixed /var/adm/wtmpx
file, to ASCII output. acctcon2 reads the ASCII records produced by acctcon1 and converts them to tacct records. acctcon1 can be used with
the -l and -o options, described below, as well as with the -p and -t options.
OPTIONS
-p Print input only, showing line name, login name, and time (in both numeric and date/time formats).
-t acctcon1 maintains a list of lines on which users are logged in. When it reaches the end of its input, it emits a session
record for each line that still appears to be active. It normally assumes that its input is a current file, so that it uses
the current time as the ending time for each session still in progress. The -t flag causes it to use, instead, the last time
found in its input, thus assuring reasonable and repeatable numbers for non-current files.
-l lineuse lineuse is created to contain a summary of line usage showing line name, number of minutes used, percentage of total elapsed
time used, number of sessions charged, number of logins, and number of logoffs. This file helps track line usage, identify
bad lines, and find software and hardware oddities. Hangup, termination of login(1) and termination of the login shell each
generate logoff records, so that the number of logoffs is often three to four times the number of sessions. See init(1M) and
utmpx(4).
-o reboot reboot is filled with an overall record for the accounting period, giving starting time, ending time, number of reboots, and
number of date changes.
EXAMPLES
Example 1 Using the acctcon command.
The acctcon command is typically used as follows:
example% acctcon -l lineuse -o reboots < tmpwtmp > ctacct
The acctcon1 and acctcon2 commands are typically used as follows:
example% acctcon1 -l lineuse -o reboots < tmpwtmp | sort +1n +2 > ctmp
example% acctcon2 < ctmp > ctacct
FILES
/var/adm/wtmpx History of user access and administration information
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWaccu |
+-----------------------------+-----------------------------+
SEE ALSO
acctcom(1), login(1), acct(1M), acctcms(1M), acctmerg(1M), acctprc(1M), acctsh(1M), fwtmp(1M), init(1M), runacct(1M), acct(2),
acct.h(3HEAD), utmpx(4), attributes(5)
NOTES
The line usage report is confused by date changes. Use wtmpfix (see fwtmp(1M)), with the /var/adm/wtmpx file as an argument, to correct
this situation.
During a single invocation of any given command, the acctcon, acctcon1, and acctcon2 commands can process a maximum of:
o 6000 distinct session
o 1000 distinct terminal lines
o 2000 distinct login names
If at some point the actual number of any one of these items exceeds the maximum, the command will not succeed.
SunOS 5.11 22 Feb 1999 acctcon(1M)