03-24-2010
Extracting part of line between two words
Hi,
I have a file few hundred MB's with text like one below in single line.
20091117 abc xyg 20091117 def ghi 20091118 ppp ttt 20091118 zzz zzz xxx
I need to extract part of line from 1st occurence of pattern 20091117
till first occurence of another pattern 20091118.
I tried awk '/20091117/,/20091118/' test
but it list line after 20091118.
20091117 abc xyg 20091117 def ghi 20091118 ppp ttt 20091118 zzz zzz xxx
any help??
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i run a command that submits a word to WordNET which stores the search results in a document which looks like this... i searched "car" in this instance
and id like to extract auto, automobile, machine, and store it in a file with the , , stripped away just the words. WordNET's results' template... (2 Replies)
Discussion started by: mark_nsx
2 Replies
2. Shell Programming and Scripting
JADE TRADER 143W MYPEN 40 HC M X10 28 7 1 0
MYPEN 20 GP X X10 15 2 1 0
MYPEN 40 GP X X10 28 7 1 0
MYPEN 20... (6 Replies)
Discussion started by: finalight
6 Replies
3. Shell Programming and Scripting
Hi all! Im trying to extract a portion of text from a KML and put it into a new file. Im trying to get all of the points out of it, ignoring everything else so I need only the text between <Placement> and </Placement>. Is there a way to make it extract all instances of these points and not just... (2 Replies)
Discussion started by: Grizzly
2 Replies
4. Shell Programming and Scripting
Hi,
Pls assist.
dn: uid=test,ou=test,dc=com
description: password
sunIdentityServerDeviceStatus: Active
uid: test
objectClass: sunIdentityServerDevice
objectClass: iplanet-am-user-service
objectClass: top
objectClass: iPlanetPreferences
sunIdentityServerDeviceType: blabla
cn: default... (3 Replies)
Discussion started by: hudson03051nh
3 Replies
5. UNIX for Dummies Questions & Answers
hello:
i have a file and i am trying to extract only unique words from that file.
i used the command: cat messages.1 | tr " " "\n" | sort | uniq -c
but using this command outputs everything unique in the file be it words, numbers, like all the characters..i need a command which will only... (6 Replies)
Discussion started by: vikbenq
6 Replies
6. Shell Programming and Scripting
I am having a file from which i need to extract different length words into different file. For example 2 letter word into file2, 3 letter word into file3 and so on....
I did one using grep and shell script..
for (( i=1; i<7; i++))
do
egrep -o '\<\(?{$i}\)?\>' $1 | sort -u -f|tr >file$i... (4 Replies)
Discussion started by: akhay_ms
4 Replies
7. Shell Programming and Scripting
here is the line on which i want to process
`empNo` int(13) NOT NULL AUTO_INCREMENT,
it sometimes doesnt have comma at the end too
`empNo` int(13) NOT NULL AUTO_INCREMENT
i want to extract all except "AUTO_INCREMENT" not only this line i ,want the code to work on any line if it has... (5 Replies)
Discussion started by: vivek d r
5 Replies
8. Shell Programming and Scripting
Hello All,
I have a text file with contents as below:
contents of error.txt:
message1="Reason for error code1"
message2="Reason for error code2"
message3="Reason for error code3.
To solve this, you may try doing restart"
I have a requirement where in I have to... (4 Replies)
Discussion started by: asterisk-ix_use
4 Replies
9. Shell Programming and Scripting
Hi there, Unix Gurus
Back in September last year you helped me find a way to extract the words in brackets in a textfile to a new one.
In that case my textfile was made up of sentences containing an only bracketed word per sentence/line:
1. If the boss's son had been , someone would... (9 Replies)
Discussion started by: eldeingles
9 Replies
10. Shell Programming and Scripting
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies
APM(8) BSD System Manager's Manual APM(8)
NAME
apm, zzz -- Advanced Power Management control program
SYNOPSIS
apm [-abdlmsSvz] [-f sockname]
zzz [-Sz] [-f sockname]
DESCRIPTION
The apm program communicates with the Advanced Power Management (APM) daemon, apmd(8), making requests of the current power status or placing
the system either into suspend or stand-by state. The apm tool is only installed on supported platforms.
With no flags, apm displays the current power management state in verbose form.
Available command-line flags are:
-z Put the system into suspend (deep sleep) mode.
-S Put the system into stand-by (light sleep) mode.
-l Display the estimated battery lifetime in percent.
-m Display the estimated battery lifetime in minutes.
-b Display the battery status: 0 means high, 1 means low, 2 means critical, 3 means charging, 4 means absent, and 255 means
unknown.
-a Display the external charger (A/C status): 0 means disconnected, 1 means connected, 2 means backup power source, and 255 means
unknown.
-s Display if power management is enabled.
-v Request more verbose description of the displayed states.
-f sockname Set the name of the socket via which to contact apmd(8) to sockname.
-d Do not communicate with the APM daemon; attempt instead to manipulate the APM control device directly.
The zzz variant of this command is an alternative for suspending the system. With no arguments, zzz places the system into suspend mode.
The command line flags serve the same purpose as for the apm variant of this command.
This command does not wait for positive confirmation that the requested mode has been entered; to do so would mean the command does not
return until the system resumes from its sleep state.
FILES
/var/run/apmdev is the default UNIX-domain socket used for communication with apmd(8). The -f flag may be used to specify an alternate
socket name. The protection modes on this socket govern which users may access the APM functions.
/dev/apmctl is the control device which is used when the -d flag is specified; it must be writable for the -d flag to work successfully.
/dev/apm is the status device used when the socket is not accessible; it must be readable to provide current APM status.
SEE ALSO
acpi(4), apm(4), apmd(8)
Intel Corporation and Microsoft Corporation, Advanced Power Management (APM) BIOS Interface Specification, Revision 1.2, February 1996.
HISTORY
The apm command appeared in NetBSD 1.3.
The APM specification first appeared in 1992. The last update to the standard was made in 1996 - the same year when it was superceded by the
ACPI 1.0 standard. Thereafter power management on IBM-compatible personal computers has relied on ACPI, implemented in NetBSD by the acpi(4)
subsystem. The acpi(4) provides an emulation layer for the legacy apm.
BSD
March 20, 2010 BSD