From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBM1PfsG018529 for ; Sat, 21 Dec 2019 20:25:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 80C7F97CFB; Sun, 22 Dec 2019 01:25:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AFC063F92 for ; Sun, 22 Dec 2019 01:25:39 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 A98978012B4 for ; Sun, 22 Dec 2019 01:25:39 +0000 (UTC) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=dkim.mimecast.com; s=201903; t=1576977939; 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:dkim-signature; bh=gth+oamdXuprQTOzmhSh5wcyd0FTIEq5RX3sK1cFM1o=; b=j2Ff33PHt+B6ehiZcRNrtlrGCkB08mFZXOeGXiOlZoEJZuvV9x6a3Y2ES0Ww86Im1Im4Qw RddxBiSbybrzSqO+cg13hPjZMtCAs+f5aeg5CDNitthm30JWGopopw/X9dViSz7SrJRGJT KDAJnRtCABl+TSl3biF4+AGpbKAjkpRFcdZAny2cP22ShjJed3oVX8qvQ/pFn/bHVVHnFI AcH1M/Hg/OisaClw2vdet/Zf4Ml36DVveBFs3Ti1GyTI14W1e1Gv1V2Yuf/hResb73C7ML JPmL5ZVCf4SbIE6k5ksmVVntGkmyMYHoopApzaFLtg5jcEz8HbGlRx4QaUTN+w== ARC-Seal: i=1; s=201903; d=dkim.mimecast.com; t=1576977939; a=rsa-sha256; cv=none; b=FPWTc1Bgd21CoNmDfJTzmGQ+LqR7A2gLYNBD7YOc9x4eRtv7sdYB3TwDiMgVNZVKkEYxdc LFznGzzq9Q06cemSEC6I2afmw5XcmUuwpnGaQrko7WPey0B4+IYPKVxCnkk5LHgVWNx1iP TAznI+BKN6GNQPtv8qBk/p229z2tb49Eq7NSrIK4vnodVDHo19dVcL2aIF0V9+NbGr5Eis 5LaxbXSGKk45q9WoiaxvtHkTli83GXLGEWtVm9ZAymuhQMKcVP09lRD4e+K2Qu/ZHBRvHR 8iYtNUte19jQgAQf22yTzrgU1CSOOej7J1iC7OXT9xnNbsSpSm15LJzqBFU4FQ== ARC-Authentication-Results: i=1; relay.mimecast.com; dkim=none (invalid DKIM record) header.d=thechases.com header.s=default header.b=UIqooU3w; spf=pass (relay.mimecast.com: domain of blinux.list@thechases.com designates 67.222.47.238 as permitted sender) smtp.mailfrom=blinux.list@thechases.com Received: from gateway10.unifiedlayer.com (gateway10.unifiedlayer.com [67.222.47.238]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-lSB_18_XPTqaPmdi-Fa1UA-1; Sat, 21 Dec 2019 20:25:37 -0500 Received: from cm3.websitewelcome.com (unknown [108.167.139.23]) by gateway10.unifiedlayer.com (Postfix) with ESMTP id 82E2B2009A7BE for ; Sat, 21 Dec 2019 19:25:35 -0600 (CST) Received: from uscentral455.accountservergroup.com ([174.136.13.174]) by cmsmtp with ESMTP id ipzzikOFMzc5jipzziIGMn; Sat, 21 Dec 2019 19:25:35 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thechases.com; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gth+oamdXuprQTOzmhSh5wcyd0FTIEq5RX3sK1cFM1o=; b=UIqooU3wcqFJ42c91Sill/g0+G EEvHj6F74BdM4DBQsf+4cF0IH5Heq+zlUIIGiwsPI5jaSXl8OjWRABlSfhP75DuwwLa+krF0Nyidw qhhyN29KTJty+iKAeX2OWsRU+56Bw15x5x81MB6qMs7/onCwAIVerQIqYerb3oyqIEPxUzVQOWDZC 299s9W+cg4cKt2wvoGUxbJizjlNd3r7sgsEO6HtPDeHeMEL0/kQ8DF1g7NDsMWnofdS5qd5yLrX13 qVo1VEmVeCe0X38ejJIvoX1r3FYXLo0bo4mHaHIARPT9Bkogb9dejb8R+8Y75hFZs25Prvy4x3tkT AdqnahRg==; Received: from 172-0-250-193.lightspeed.rcsntx.sbcglobal.net ([172.0.250.193]:44373 helo=bigbox.attlocal.net) by uscentral455.accountservergroup.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1iipzz-0018lK-7h for blinux-list@redhat.com; Sat, 21 Dec 2019 19:25:35 -0600 Date: Sat, 21 Dec 2019 19:25:34 -0600 To: Linux for blind general discussion Subject: Re: ex syntax? Message-ID: <20191221192534.55df0f8d@bigbox.attlocal.net> In-Reply-To: References: MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - uscentral455.accountservergroup.com X-AntiAbuse: Original Domain - redhat.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - thechases.com X-BWhitelist: no X-Source-IP: 172.0.250.193 X-Source-L: No X-Exim-ID: 1iipzz-0018lK-7h X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 172-0-250-193.lightspeed.rcsntx.sbcglobal.net (bigbox.attlocal.net) [172.0.250.193]:44373 X-Source-Auth: tim@thechases.com X-Email-Count: 1 X-Source-Cap: dGhlY2hhc2U7dGhlY2hhc2U7dXNjZW50cmFsNDU1LmFjY291bnRzZXJ2ZXJncm91cC5jb20= X-Local-Domain: yes X-MC-Unique: lSB_18_XPTqaPmdi-Fa1UA-1 Authentication-Results: relay.mimecast.com; dkim=none (invalid DKIM record) header.d=thechases.com header.s=default header.b=UIqooU3w; spf=pass (relay.mimecast.com: domain of blinux.list@thechases.com designates 67.222.47.238 as permitted sender) smtp.mailfrom=blinux.list@thechases.com X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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 01:25:42 -0000 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.