Sponsored Content
Full Discussion: Again Substring!!!! Help
Top Forums Shell Programming and Scripting Again Substring!!!! Help Post 302340293 by jim mcnamara on Monday 3rd of August 2009 07:07:30 AM
Old 08-03-2009
Code:
awk '{ pos=instr($0, " E"); if(pos) {pos++; $0=substr($0,pos) }; print $0}' filename

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

substring

Hi, I have a value of a filepath in a variable DATAFILE with value as "customtop/gpsore37/gepspo/1.0/bin/ashoka.csv ". Now i want the value of last 4 charcters in to another variable. That is EXTENSION = .csv How can i do this in Shell scripting Thanks in advance Alla Kishore (8 Replies)
Discussion started by: alla.kishore
8 Replies

2. Shell Programming and Scripting

How do I Substring ??

Hello everyone. I'm writing a script in UNIX. The purpose is to get the second character from a variable that stores the system year. This is the code: unix_year_yy=`date "+%g"` This will return "07" in variable unix_year_yy. How can I get the second character (7)?? (6 Replies)
Discussion started by: Rigger
6 Replies

3. Shell Programming and Scripting

substring

Dear All, i have a file that contains, FROM_DATE: 06-08-2007 00:00:00 TO_DATE: 06-08-2007 23:59:59 Total number of lines: 6874154 in another file,the contain is, FROM_DATE: 06-08-2007 00:00:00 Total number of lines: 874154 alltime i want to find the particular string... (4 Replies)
Discussion started by: panknil
4 Replies

4. Shell Programming and Scripting

Substring HELP!

Hi, I am trying to do something which I thought was very simple but still being a beginner, has proved not to be. Input: val1 val2 val3 val4 val5 val6 . . . etc Desired Output: Every row in which value of val6 is a number starting with 0.0 or contains a capital E. The input... (2 Replies)
Discussion started by: awknerd
2 Replies

5. UNIX for Dummies Questions & Answers

Need help with substring

I need to check the occurrence of one string within another. code ******************** if ;then do something done ******************** Thanks (7 Replies)
Discussion started by: w020637
7 Replies

6. UNIX for Dummies Questions & Answers

Substring

Hi I use the below cmd to get the list of files that are modified than <temp> file in the <path> diretory cmd:find <path> -name '*.zip' -type f -newer <temp> -print i am getting all the list of files that are new or modified, with abs path, i want to copy all of these files to a... (3 Replies)
Discussion started by: Naveen_5960
3 Replies

7. Shell Programming and Scripting

substring

I have a string '<Hi>abc</Hi>" How to print "abc" (6 Replies)
Discussion started by: sandy1028
6 Replies

8. UNIX for Dummies Questions & Answers

Getting Substring

Hi, I hav a string lets say aa.txt:bb:txt length of the string can vary.. I have to keep the token inside a array and the delimiter is : plz send me the code (2 Replies)
Discussion started by: Deekay.p
2 Replies

9. Shell Programming and Scripting

Get the substring

Hi All, I have a ouput string likes 'u8wos' or 'u10acsd' or somthing else 'u{number}{any characters}'and I want to get the number behind the letter 'u' by bash shell. Thanks Damon (11 Replies)
Discussion started by: Damon_Qu
11 Replies

10. Shell Programming and Scripting

Substring

Hi All, In ksh, am trying to get a substring stuff done. Not sure where the problem is.. can you guys guide me on this... for instance, var1=41, and var2=4175894567, then i want to know whether var2 starts with var1.. var1 and var2 can be of any length.. VAR1=41 VAR2=419068567777... (6 Replies)
Discussion started by: nram_krishna@ya
6 Replies
acctcon(8)						      System Manager's Manual							acctcon(8)

NAME
acctcon1, acctcon2 - Display connect-time accounting summaries SYNOPSIS
acctcon1 [-l file] [-o file] [-p] [-t] acctcon2 FLAGS
Writes line-usage format from the input file (usually /var/adm/wtmp) to file for the accounting period during which the file /var/adm/wtmp is active. The following example shows the ASCII line-usage heading format: TOTAL DURATION: 57 MINUTES LINE MINUTES PERCENT # SESS # ON # OFF pty/ttyp4 37 64 3 3 7 console 26 45 2 2 4 pty/ttyp5 7 11 1 1 3 pty/ttyp6 0 0 0 0 2 TOTALS 69 - 6 6 16 TOTAL DURATION specifies the total number of minutes used for connect sessions during the accounting period during which the /var/adm/wtmp file is active. The columns specify the line name, the number of session minutes used, the percentage of total elapsed time used for the sessions, the number of sessions charged, the number of logins, and the number of logouts. The last line in the line-usage file totals the entries for each column. The line-usage format helps to track line usage and identify bad lines. All hangups, terminations of the login command, and termi- nations of the login shell cause the system to write logout records, so that the number of logouts is often greater than the number of sessions. Writes an overall-record format to file from the input file (usually /var/adm/wtmp) for the accounting period during which the /var/adm/wtmp file is active. The following example shows the overall-record format: from mon day date hh:mm:ss yyyy tz to mon day date hh:mm:ss yyyy tz 2 date changes Number of times the date was changed. 21 acctg off Number of times accounting functions were turned off. 25 run-level S Number of times accounting functions ran in single-user mode. 108 system boot Number of times the system was rebooted. 21 acctg on Number of times accounting functions were turned on. 21 acctcon1 Number of times the acctcon1 command was issued. The first lines specify the date and time stamp, including time zone, of the accounting period start time and end time. Writes the input file (usually /var/adm/wtmp) to the default output device. For example: pty/ttyp1 hoff 616883748 Jul 19 16:35:48 1990 EST pty/ttyp1 hoff 616883825 Jul 19 16:37:05 1990 EST pty/ttyp1 LOGIN 616883833 Jul 19 16:37:13 1990 EST pty/ttyp1 tom 616883837 Jul 19 16:37:17 1990 EST The output columnar format lists the line reference name, the login name, the time in seconds since January 1, 1970, 0 hours, 0 min- utes, 0 seconds, the date, the 24-hour clock time, the year, and the time zone. Uses the last time found in the input file as the ending time for any current processes. This time, rather than current time, is necessary to have reasonable and repeatable values for noncurrent files. The output format is the same as the default output format. The acctcon1 command also maintains a list of ports on which users are logged in. When the acctcon1 command reaches the end of its input, a session record is written for each port that still appears to be active. The acctcon1 command assumes that the input source is the current file and uses current time as the ending time for each session still in progress. DESCRIPTION
The acctcon1 and acctcon2 commands are described separately. acctcon1 The acctcon1 command is invoked by the runacct shell procedure to write a sequence of login and logout records. One record for each con- nect session is written to the specified destination as a sequence of login session records. The /var/adm/wtmp source file should be directed as input to the command. The following example shows the default ASCII columnar output format: 285212673 1192 hoff 85 0 616883748 Jul 19 16:35:48 1990 EST 285212673 1033 tom 10 0 616883837 Jul 19 16:37:17 1990 EST 285212673 0 root 1345 2852 616883855 Jul 19 16:37:35 1990 EST 285212673 1120 jim 0 62 616888058 Jul 19 17:47:38 1990 EST The columns contain the following information: Device address, expressed as a decimal equivalent of the major/minor device address at which the connection was activated. User ID assigned for the connect-session record. Login name under which the session took place. Total num- ber of prime-time seconds for the connect session. Total number of nonprime-time seconds for the connect session. Seconds since the date 0 hours, 0 minutes 0 seconds, 1 January 1970. Month, day of the month, connect-session starting time, year, and time zone. The order of date and time information is locale dependent. The timestamps shown use the default format for date and time values; however, you can define the NLTIME environment variable to change this format. acctcon2 The acctcon2 command is invoked by the runacct shell procedure. It converts a sequence of login session records produced by the acctcon1 command into connect-time total accounting records. These records are often merged with other total accounting records with the acctmerg command to produce a daily report. EXAMPLES
The following example converts login records to a default format login session record report: acctcon1 -t /var/adm/lineuse -o /var/adm/reboots < /var/adm/wtmp > /var/adm/logsess The previous example generates three files. The /var/adm/logsess file lists ending date and 24-hour timestamp records that correspond with the last time that input was obtained with the -t flag. For the accounting period covered by the /var/adm/wtmp file, the /var/adm/lineuse line-usage summary file is generated by the -l flag, and the /var/adm/reboots overall record file is obtained with the -o flag. The following example converts a series of login session records in the /var/adm/logsess file to a total accounting record in the /var/adm/logacct binary file: acctcon2 < /var/adm/logsess > /var/adm/logacct FILES
Specifies command path. Specifies command path. The active login/logout database file. Accounting header files that define formats for writing accounting files. RELATED INFORMATION
Commands: login(1), acct(8), acctmerg(8), fwtmp(8), init(8), wtmpconvert(8). Functions: acct(2). delim off acctcon(8)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy