|
|
match whitespace at start of line
Hi,
please forgive newbie confusion.
using GNU Awk 3.5.1 on Cygwin.
how can I match one or more
spaces and/or tabs at the
start of a line?
Thanks, Jeff Higgins
|
|
0
|
|
|
|
Reply
|
oohiggins (266)
|
10/19/2005 3:23:09 PM |
|
Jeff Higgins wrote:
> Hi,
> please forgive newbie confusion.
> using GNU Awk 3.5.1 on Cygwin.
>
> how can I match one or more
> spaces and/or tabs at the
> start of a line?
>
> Thanks, Jeff Higgins
>
>
awk '/^[ \t]+/'
Regards,
Steffen
|
|
0
|
|
|
|
Reply
|
Steffen
|
10/19/2005 3:30:11 PM
|
|
Steffen Schuler wrote:
> Jeff Higgins wrote:
>
>> Hi,
>> please forgive newbie confusion.
>> using GNU Awk 3.5.1 on Cygwin.
>>
>> how can I match one or more
>> spaces and/or tabs at the
>> start of a line?
As an RE for one of the *sub() commands to replace, or just a pattern to
match as the condition part of the awk body?
>> Thanks, Jeff Higgins
>>
> awk '/^[ \t]+/'
No need for the "+" in that case.
Ed.
|
|
0
|
|
|
|
Reply
|
Ed
|
10/19/2005 3:36:50 PM
|
|
<SNIP>
As a match pattern.
Please see my forthcoming post.
Thank you and Steffen very much for your help.
Jeff Higgins
|
|
0
|
|
|
|
Reply
|
Jeff
|
10/19/2005 4:41:13 PM
|
|
|
3 Replies
196 Views
(page loaded in 0.086 seconds)
Similiar Articles: Newline after xml tag - comp.soft-sys.sas... text></ROW> <ROW><text>no spaces</text><more>yipee</more ... I was thinking I could match </*> and inject a newline ... 1252" ?>'; put '<ROWSET>'; end; start = 1 ... Parsing file names with spaces - comp.lang.perl.misc... so skip to the size, then match a ... file2 onespace.zip >file3 two spaces.zip Easy. split() the line ... exec with start and file names with spaces - comp.lang.tcl ... Grep string with spaces - comp.unix.shellIt will also match 192b168a100d1, or any character ... TSV files that start or end with spaces. # caterr = a string to ... find string in file - comp.unix.shell... one line ... Macro to send the alert message on ping failure - comp.sys.tandem ...So I will give you a rough start on the TACL code ... If none of the output lines match that pattern, do_ping ... shich shows the statitics since there are line spaces in ... Split text into equal characters but keeping whole words - comp ...... line to cut off before ruby and then start at ruby for the next line. ... A word break is any newline or whitespace - see ... invert an array - comp.soft-sys.matlab Match ... Printing from field 14 to end of record - comp.lang.awkIf you need to preserve, for instance, variable whitespace ... an RE which matches the first 14 fields, then use match ... Multiple line fields - comp.lang.awk #last line of ... I have a isNumeric function to check a text field is numeric .. I ...... var numericExpression = /^[0-9]+$/; if(str.match ... answered perfectly and reliably, with even all the spaces ... Correct <= 4-line sig. separator as above, a line ... Sampling: What Nyquist Didn't Say, and What to Do About It - comp ...I prefer not to have spaces around an em dash, but that ... It is considered poor style to start a line with a number ... options in how loosely the features must match to be ... syslogd not logging anymore - comp.unix.solaris... etc/init.d/syslog stop; /etc/init.d/syslog start ) I ... debug mode I would check to see if there are any spaces ... written on /var/adm/messages > > The offending line ... grep for a "`g'"? (gives an "Unmatched `" err) - comp.unix.solaris ...... then you have to escape the quote you are trying to match ... unescaped, they are interpreted by the shell as the start ... oracle.server Or grep those names to : > find the line ... Regex Tutorial - Start and End of String or Line Anchors^\s+ matches leading whitespace and \s+$ matches trailing whitespace. In ... and regex tools like PowerGREP, the caret and dollar always match at the start and end of each line. RegEx Beginning of line or whitespace matchRe^2: RegEx Beginning of line or whitespace match by ZlR (Chaplain) on Feb 12, 2005 at 17:22 UTC. I do not think the alternation of space with "start of line" is a ... 7/24/2012 6:42:06 AM
|
|
|
|
|
|
|
|
|