From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBM4URRv021612 for ; Sat, 21 Dec 2019 23:30:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA4E12166B29; Sun, 22 Dec 2019 04:30:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C5C272166B27 for ; Sun, 22 Dec 2019 04:30:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0A471019297 for ; Sun, 22 Dec 2019 04:30:25 +0000 (UTC) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=dkim.mimecast.com; s=201903; t=1576989025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KHJ5K+7PbNQcSyCAixBVVyaJVBBwYmkWVq/9ZKcRWYk=; b=mz9DEnAUEGwKcAc5BvYfC5fOpj2MvE9+c8rBk2krba7pGoC9PwaFswLb+mLvm7ley++kkk XWvEpY9TInGOdiPh6ULKufdCECQEELNyvQhETXqYQRar9ythqkrRSsfjbFxbPJTDSPaSUV OWjV3gmSQjtGr65Ujmir5AREsUg2R48QBcTWBNcjYNcXXr7J1opKi4h9zoSVJaaDKbfxir AtNdRT0l1Zq3djUqcNzNlDZOAM3Io0Dd1dyGQb0Q016WfvVSqnryHlndbyaCNTAFMMYPZ2 EEla53RgnMRBT3BpDEqHESCZHfw2Q+koQCaWK7wrDFAS0BEHEVNqJQVQCMJnfw== ARC-Seal: i=1; s=201903; d=dkim.mimecast.com; t=1576989025; a=rsa-sha256; cv=none; b=jc1yQjUzYROmgmTyBQmgkcZ/3FPrnzmgx0vdTvoBXU+oDxAr56f0wu3Zm5l5U6qW1YDOn4 VFnZTt+EzZkWnNXMrycS2IH/DzvRu+ddfYq7Y/AHUS32oS89uNkm7myGKwhciD0hzdWUDu 9ZyiHWe5z9XyT8h/hdZZlX44TbXNAdxAez47xy+V5cWsnk5+Ge90Mrt7i7/p1UCPJt9obb mhPkEBvrIffUPbVIhTM6HpVlCWGNbugw2XZiaEI74Wsu48B6AZDWL1tL/1j5Li54shNbAO nIwLJmKlxLKcUrXe1ZPxu2mKEixrpMToqAENhrwEEOT4O7gtKK9B6rmKWurC9g== ARC-Authentication-Results: i=1; relay.mimecast.com; dkim=none; spf=pass (relay.mimecast.com: domain of jdashiel@panix.com designates 166.84.1.89 as permitted sender) smtp.mailfrom=jdashiel@panix.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-38-AIt4OtjzOpe9vq6v-b15TQ-1; Sat, 21 Dec 2019 23:29:43 -0500 Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mailbackend.panix.com (Postfix) with ESMTP id 47gTzB6G0gzy9t for ; Sat, 21 Dec 2019 23:29:42 -0500 (EST) Received: by panix1.panix.com (Postfix, from userid 20712) id 47gTzB4rJ0zcbc; Sat, 21 Dec 2019 23:29:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by panix1.panix.com (Postfix) with ESMTP id 47gTzB4NmgzcbW for ; Sat, 21 Dec 2019 23:29:42 -0500 (EST) Date: Sat, 21 Dec 2019 23:29:42 -0500 To: Linux for blind general discussion Subject: Re: ex syntax? In-Reply-To: <20191221192534.55df0f8d@bigbox.attlocal.net> Message-ID: References: <20191221192534.55df0f8d@bigbox.attlocal.net> MIME-Version: 1.0 X-MC-Unique: AIt4OtjzOpe9vq6v-b15TQ-1 Authentication-Results: relay.mimecast.com; dkim=none; spf=pass (relay.mimecast.com: domain of jdashiel@panix.com designates 166.84.1.89 as permitted sender) smtp.mailfrom=jdashiel@panix.com X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBM4URRv021612 X-loop: blinux-list@redhat.com From: Linux for blind general discussion X-BeenThere: blinux-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: blinux-list@redhat.com List-Id: Linux for blind general discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2019 04:30:28 -0000 Just white space, I'm doing things with bash scripts. On Sat, 21 Dec 2019, Linux for blind general discussion wrote: > Date: Sat, 21 Dec 2019 20:25:34 > From: Linux for blind general discussion > To: Linux for blind general discussion > Subject: Re: ex syntax? > > Tim here. > > If you're using ed or sed rather than ex/vi/vim, it's pretty easy > depending on what constitutes a "word" (do you include punctuation > as word-separation, or just white-space? What about contractions > like "can't" or abbreviations like "Dr."?). You can use > > 6s/[^[:space:]]\{1,\}/replacement/6 > 6s/[[:alpha:]]\{1,\}/replacement/6 > > in both cases. The first 6 is the line-number, the 2nd 6 is the 6th > word in the line. > > In ex/vi, it's a bit more complex because they don't support the > numeric flag at the end to indicate the 6th one, so you'd have to do > something atrocious like > > 6s/\(\([^[:space:]]\{1,\}[[:space:]]\{1,\}\)\{5\}\)[^[:space:]]*/\1replacement/p > > (that "5" is the 5 words before the one you want to replace). It > would generally be easier to just retype the line. > > It might be easier to prompt for a replacement: > > 6s/[^[:space:]]\{1,\}/xxx/gc > > and then answer "no" 5 times, then answer "yes" for the 6th one. > > If you're running the ex-mode of vim instead of vi, vim provides more > powerful regular expressions so you can do > > 6s/\(\W*\zs\w\+\)\{6}/replacement > > Vim's regex also makes it easy to define what constitutes a > word-vs-not-a-word (using "\w" and "\W") or > whitespace-vs-non-whitespace (using "\s" and "\S"). Depending on how > you define a "word" the ed/sed/ex/vi versions get a lot messier. > > Hope this helps, > > -Tim (the vi/vim/ed/ex geek behind the @ed1conf account on Twitter) > > > On December 21, 2019, Linux for blind general discussion wrote: > > On line 6 of a file what is the command to delete word 6 on that > > line? A long time ago when the bsd learn utility was working on a > > system I studied the advanced ex lessons and unfortunately forgot > > that syntax. > > > _______________________________________________ > Blinux-list mailing list > Blinux-list@redhat.com > https://www.redhat.com/mailman/listinfo/blinux-list > > --