Skip to main content

All Questions

Tagged with
7 votes
6 answers
1k views

How to cause awk to fail if previous command (tar) also fails?

I have a bit of an issue with the following command which extracts a tar file & prints how many files have been extracted every second: tar -xvf some_tar.tar -C a/directory | awk 'systime() > ...
Foobar's user avatar
  • 273
-3 votes
1 answer
255 views

Extract an ID that matches the user login from a table on shell script

So, I have all these user login information (service, admin, J009878) and this table you see here comes from another command whose output is this table which I save in file.txt. What I want to achieve ...
BishwashK's user avatar
1 vote
2 answers
7k views

USB reset using lsusb output

I have a USB device that I wish to reset automatically, there are two USB devices currently, but at times there may be more. [user1@gs10 devt]$ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation ...
Beaker's user avatar
  • 67
1 vote
1 answer
2k views

Piping to multiple awk commands

I'm trying to pipe the output of one command to two different awk commands. Following this post I am using tee and process substitution. However, I can't see the output for the substituted process. ...
ludog's user avatar
  • 17
6 votes
3 answers
4k views

recursively count lines in files, group by file extension

Question I have a git repository full of files, mostly text. I want to know that there are n lines of code in files ending in .py m lines of code in files ending in .md o lines of code in files ...
falsePockets's user avatar
3 votes
5 answers
1k views

Sum in bash outside while read line

I'm trying to come up with the sum of lines in .js files in a folder. I'm using this in bash: sum=0 && find . | grep ".js" | while read -r f; do wc -l $f | awk '{print $1;}'; done; putting ...
d9ngle's user avatar
  • 357
1 vote
2 answers
488 views

awk not recognized in shell script

I'm trying to do floating point arithmetic in a shell script. I learned that awk can do it on the command line, but the way it works there does not seem to carry over to a shell script. When I type ...
whatIsLife's user avatar
3 votes
2 answers
12k views

How can I get feh to set wallpaper to each monitor according to its size?

I have a directory filled with png files $ tree ~/wallpaper/ ~/wallpaper/ ├── foo--1366x768.png ├── foo--1920x1080.png ├── foo--2048x1080.png ├── foo--3440x1440.png └── foo--3840x2160.png 0 ...
Brian Fitzpatrick's user avatar
1 vote
2 answers
5k views

Pipe and filter bash outputs in realtime

I am running some commands in bash (basically some ffmpeg commands), that I'm using grep and awk to filter out the results. The command takes some time and continously outputs some results as it ...
Mary's user avatar
  • 165
0 votes
1 answer
1k views

Parse a tabular contents of a file using bash one-liner or script

I have been trying to figure out on how to sort through a log file (format pasted below) using linux commands for sometime and I just can't get it to work. The file has a setup as follows; columnA | ...
BrianNo's user avatar
  • 11
5 votes
1 answer
1k views

Having problems with bash array $PIPESTATUS

I'm working on a script (that will run on OSX, and probably nothing else), that basically just parses the /var/log/accountpolicy.log* logs for authentication times/counts. The initial command is a ...
Justin's user avatar
  • 535
8 votes
1 answer
5k views

Pass colors from ls through pipe to awk 'print' statement

This is a follow-up to my question from yesterday, Show sum of file sizes in directory listing. Thanks to Zero Piraeus and a point in the right direction by Mauritz Hansen, I now have function dir() {...
MattDMo's user avatar
  • 2,444