Sponsored Content
Top Forums Shell Programming and Scripting Sending output of program into subsequent commands (i.e. awk/sort) Post 303036411 by sand1234 on Tuesday 25th of June 2019 05:15:24 AM
Old 06-25-2019
RudiC,
This works perfectly:

Code:
$ docker image ls | awk 'NR==1 {print; next} {print | "sort -Vrk5"}'
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
linode/lamp         latest              2359fa12fded        4 years ago         372MB
centos              latest              9f38484d220f        3 months ago        202MB
ubuntu              xenial              13c9f1285025        6 days ago          119MB
ubuntu              latest              4c108a37151f        6 days ago          64.2MB
alpine              latest              4d90542f0623        5 days ago          5.58MB

Is there any way to use command chaining like I used previously for this example? i.e. multiple redirections.
Quote:
cat <(head -n1 test.txt) <(awk '/C/' test.txt)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

combining unix commands and awk program

Dear Experts I am trying to find if it is possible to combine unix commands in awk program. For example if it is possible embed rm or ls or any unix command inside the awk program and while it is reading the file besides printing be able to do some unix commands. I am thinking may be just print... (2 Replies)
Discussion started by: Reza Nazarian
2 Replies

2. UNIX for Dummies Questions & Answers

Using the Sort, Cut, and Awk commands

Hello, I am trying, utilizing the few commands I know, to extract all records within my file that were generated in November of 2007. Each record within the file has a "date" field giving the month, day, and year (9-8-88). How do I extract those records to their own file? Once I extract... (4 Replies)
Discussion started by: babbabooey
4 Replies

3. UNIX for Dummies Questions & Answers

Sending awk output to nothing?

How can I direct awk output to go nowhere? I can write the data to a file easy enough or print it on the screen. But for this particular command I don't actually want the data and I don't want to create a file. I just want the data discarded. Thanks in advance (3 Replies)
Discussion started by: MrEddy
3 Replies

4. Shell Programming and Scripting

awk text record - prepend first field to all subsequent fields

Hello everyone, I've suddenly gotten very interested in sed and awk (and enjoying it quite a bit too) because of a large conversion project that we're working on. I'm currently stuck with a very inefficient process for processing text blocks. I'm sure someone here should be able to easily point out... (2 Replies)
Discussion started by: jameswatson3
2 Replies

5. Shell Programming and Scripting

awk - use fields from subsequent lines

I've run into a problem getting exactly what I want out of awk - some folks may recognize this as an output from Amazon's ec2-describe-instances: Given the following: INSTANCE i-4960f321 BLOCKDEVICE Line2Var2 TAG instance i-4960f321 Name web1 TAG instance i-4960f321... (2 Replies)
Discussion started by: colinjohnson
2 Replies

6. UNIX for Dummies Questions & Answers

is there a way to assing variable a value that is output of a program in awk script?

Hi there is there a way to assing variable a value that is output of a program in awk script. For e.g., I did temp=(`grep "" $5 | cut -f8 -d' '`) but it does not work. Any advice??? Thanks in advance!!! :) (3 Replies)
Discussion started by: FUTURE_EINSTEIN
3 Replies

7. Shell Programming and Scripting

Want to sort a file using awk & sed to get required output

Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly: Required output: 01FB 10000000c97843a2 8C 0 01FB 10000000c96fb279 9C 0 22AF 10000000c97843a2 8C 0 22AF 10000000c975adbd ... (10 Replies)
Discussion started by: aix_admin_007
10 Replies

8. Shell Programming and Scripting

Pipe or combine output of three awk commands

What is the correct syntax to pipe or run three awk commands? Basically, using the output of the first awk as input in the second. Then using the output of the second awk in the third. Thank you :). awk 'FNR==NR {E; next }$3 in E {print $3, $5}' panel_genes.txt RefSeqGene.txt > update.txt |... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. Shell Programming and Scripting

awk capturing first sample, but not subsequent id's

In the awk below the first sample MEV45 gets extracted from the html, but the subsequent MEV46 and MEV47 do not as they are not part of parse. I can not seem to add them to the code. Thank you very much @RudiC your awk is very nice :). input {"barcodeId": "IonXpress", "barcodedSamples":... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. Shell Programming and Scripting

awk Sort 2d histogram output from min(X,Y) to max(X,Y)

I've got Gnuplot-format 2D histogram data output which looks as follows. 6.5 -1.25 10.2804 6.5404 -1.25 10.4907 6.58081 -1.25 10.8087 6.62121 -1.25 10.4686 6.66162 -1.25 10.506 6.70202 -1.25 10.3084 6.74242 -1.25 9.68256 6.78283 -1.25 9.41229 6.82323 -1.25 9.43078 6.86364 -1.25 9.62408... (1 Reply)
Discussion started by: chrisjorg
1 Replies
GIT-REFLOG(1)							    Git Manual							     GIT-REFLOG(1)

NAME
git-reflog - Manage reflog information SYNOPSIS
git reflog <subcommand> <options> DESCRIPTION
The command takes various subcommands, and different options depending on the subcommand: git reflog expire [--dry-run] [--stale-fix] [--verbose] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>... git reflog delete ref@{specifier}... git reflog [show] [log-options] [<ref>] Reflog is a mechanism to record when the tip of branches are updated. This command is to manage the information recorded in it. The subcommand "expire" is used to prune older reflog entries. Entries older than expire time, or entries older than expire-unreachable time and not reachable from the current tip, are removed from the reflog. This is typically not used directly by the end users -- instead, see git-gc(1). The subcommand "show" (which is also the default, in the absence of any subcommands) will take all the normal log options, and show the log of the reference provided in the command-line (or HEAD, by default). The reflog will cover all recent actions (HEAD reflog records branch switching as well). It is an alias for git log -g --abbrev-commit --pretty=oneline; see git-log(1). The reflog is useful in various git commands, to specify the old value of a reference. For example, HEAD@{2} means "where HEAD used to be two moves ago", master@{one.week.ago} means "where master used to point to one week ago", and so on. See gitrevisions(7) for more details. To delete single entries from the reflog, use the subcommand "delete" and specify the exact entry (e.g. "git reflog delete master@{2}"). OPTIONS
--stale-fix This revamps the logic -- the definition of "broken commit" becomes: a commit that is not reachable from any of the refs and there is a missing object among the commit, tree, or blob objects reachable from it that is not reachable from any of the refs. This computation involves traversing all the reachable objects, i.e. it has the same cost as git prune. Fortunately, once this is run, we should not have to ever worry about missing objects, because the current prune and pack-objects know about reflogs and protect objects referred by them. --expire=<time> Entries older than this time are pruned. Without the option it is taken from configuration gc.reflogExpire, which in turn defaults to 90 days. --expire-unreachable=<time> Entries older than this time and not reachable from the current tip of the branch are pruned. Without the option it is taken from configuration gc.reflogExpireUnreachable, which in turn defaults to 30 days. --all Instead of listing <refs> explicitly, prune all refs. --updateref Update the ref with the sha1 of the top reflog entry (i.e. <ref>@{0}) after expiring or deleting. --rewrite While expiring or deleting, adjust each reflog entry to ensure that the old sha1 field points to the new sha1 field of the previous entry. --verbose Print extra information on screen. GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-REFLOG(1)
All times are GMT -4. The time now is 10:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy