Deutsch English Français Italiano |
<877cibsbja.fsf@yaxenu.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Julieta Shem <jshem@yaxenu.org> Newsgroups: comp.lang.awk Subject: Re: "sed" question Date: Sat, 09 Mar 2024 11:52:09 -0300 Organization: A noiseless patient Spider Lines: 17 Message-ID: <877cibsbja.fsf@yaxenu.org> References: <us9vka$fepq$1@dont-email.me> <usa01v$fj5h$1@dont-email.me> <usagql$j9bc$1@dont-email.me> <slrnuuolcp.2g4k.naddy@lorvorc.mips.inka.de> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="d3697e664b2fe3b42eda67e412b665fb"; logging-data="2501424"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181u35AYjoDYbmznq9VoJiXzIs1PAYIw+c=" Cancel-Lock: sha1:K8dGCQZ+GIiB3DDABHdi0UDoj5c= sha1:JBvNrLa/fWKpSZIGT18NmIXXkw4= Bytes: 1560 Christian Weisgerber <naddy@mips.inka.de> writes: > On 2024-03-06, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote: > >>> $ awk '{print $1, "1-1"}' newsrc-news.eternal-september.org-test > >>> newsrc-news.eternal-september.org >> >> In this specific case of regular data you can simplify that to >> >> awk '$2="1-1"' sourcefile > targetfile > > That had me scratching my head. You can't have an action without > enclosing braces. But it's still legal syntax because... it's an > expression serving as a pattern. The assignment itself is a side > effect. Without braces, the default action takes place, which is ``{print}''.