Search Results

Search: Posts Made By: protocomm
1,060
Posted By RudiC
Why not i=120; while ((i--)); do sleep 1; date;...
Why not i=120; while ((i--)); do sleep 1; date; done
12,669
Posted By MadeInGermany
The condition ? trueaction : falseaction exists...
The condition ? trueaction : falseaction exists in awk like in C.
str gets the concatentation of str "\n" $0 if str is not null (undefined, empty, or 0), otherwise it gets $0.
$0 is the entire...
5,914
Posted By Scrutinizer
You're welcome. Yes, the for loop does not...
You're welcome. Yes, the for loop does not redirect stdin, whereas the while read loop does. stdin is needed by the ssh command, so ssh was complaining that stdin could not be used..
The adaptation...
1,861
Posted By Don Cragun
If you have a lot of old files to remove, this...
If you have a lot of old files to remove, this may be noticeably faster:
find $backupDir -type f -mtime +30 -exec rm {} +
When you terminate the -exec primary with a semicolon, you invoke rm once...
2,827
Posted By Corona688
Unless it's doing something weird like trying to...
Unless it's doing something weird like trying to parse unicode characters, there should be no such thing as an 'illegal byte sequence' in tr. Try LOCALE="C" tr ...
2,827
Posted By Chubler_XL
How about using strings: -n 1 will detect a...
How about using strings: -n 1 will detect a sequence of 1 or more printable characters:

$ printf "%s" $(strings -n 1 20150118_1920.txt ) | fold...
2,827
Posted By wisecracker
A starter idea longhand OSX 10.7.5 default bash...
A starter idea longhand OSX 10.7.5 default bash terminal.
A pure flat file only as we have no idea of the layout...
ALL values below decimal 32 and above 126 not converted...
#!/bin/bash
#...
1,918
Posted By Don Cragun
What is the output from the command: ls | od...
What is the output from the command:
ls | od -bcwhen you are in this directory?
1,674
Posted By RudiC
x is reassigned every time a line starting with...
x is reassigned every time a line starting with "2" is read, and is set to 1 (="on") if that line's $1 is found in the m array, to 0 (="off") if not.
ALL lines are printed as long as x is 1.
1,226
Posted By Scrutinizer
Mind the details: sed...
Mind the details:
sed 's/^10\.0\.108\..*/10.0.108.11/' file
There needs to be an ^ anchor at the start , otherwise it may match 110.0.108. for example. The anchor at the back can be provided by the...
2,429
Posted By Don Cragun
ShriniShoo and protocol, The last two digits in...
ShriniShoo and protocol,
The last two digits in the timestamps you're incrementing in your scripts represent minutes. There are 60 minutes per hour; not 100. Most implementations of the touch...
912
Posted By Scrutinizer
If the records are grouped, you could try: awk...
If the records are grouped, you could try:
awk '{i=$1 FS $2 FS $3} i!=p {if(p) print p,"TOTAL",t ORS; t=0} {p=i; t+=$6}1 END{print p,"TOTAL",t}' FS=, OFS=, file
2,235
Posted By Yoda
Or try using column...
Or try using column (https://www.unix.com/man-page/linux/1/column/) command:
$ column -t input.txt
abc
qwert
qwer
afweferf
wdfwefwe ==> kjhjkwdd
mnmn ==> jkjkjwekj
poiu ==> ...
1,530
Posted By Corona688
A basic bourne shell doesn't understand regexes,...
A basic bourne shell doesn't understand regexes, only globs. There are no modifiers like * or +. only ranges [A-Z], and any single-character-match ?. Also, the glob must always match the entire...
1,530
Posted By RudiC
Yes, that's grep and sed and awk, but not shell.
Yes, that's grep and sed and awk, but not shell.
1,530
Posted By RudiC
Doesn't look like there's a . in the filenames....
Doesn't look like there's a . in the filenames. Don't confuse regex (with . wildcard) and shell patterns (which do not accept . for a wildcard)
1,530
Posted By 116@942
I guess, you are assuming shell to interpret ....
I guess, you are assuming shell to interpret . and * as regular expression metacharacters, however shell supports glob at the point where you use it. * in glob has a different meaning then a * in...
1,028
Posted By Don Cragun
This can all be done with standard variable...
This can all be done with standard variable expansions without needing to invoke utilities that aren't built into the shell:
if [ "${runbatch#*FCST}" != "$runbatch" ]
then ****Run Program***
fi...
3,119
Posted By Don Cragun
So, let's look at what we get from cal (either...
So, let's look at what we get from cal (either with no operands, or a month operand and a year operand):
August 2014
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12...
1,113
Posted By MadeInGermany
With implicit if and default print: awk -F";"...
With implicit if and default print:
awk -F";" '$1 !~ /[aA]/' file
1,300
Posted By Akshay Hegde
Hi protocomm, 1. Variable s saves every line...
Hi protocomm,

1. Variable s saves every line $0 where NF is greater than 0 NF{.., with ORS,so blank line are skipped here.

2. I used *, inorder to replace it with coming date and time where...
2,375
Posted By Don Cragun
I should have said BREs rather than back...
I should have said BREs rather than back references, but the times I most often see a sed substitute command fail is when I'm using back references. On the Linux sed man page...
1,099
Posted By ygemici
then try like this sed...
then try like this
sed 's/intermediation\//\'$'\n/g' input.text
3,250
Posted By Don Cragun
The point is that in message #13 in this thread,...
The point is that in message #13 in this thread, you implied that
cp filename file.backup && \
awk 'awk_commands' file.backup > file && \
rm filename.backup
and
var=$(awk 'awk_commands'...
3,250
Posted By Don Cragun
This is extremely dangerous. First, I assume...
This is extremely dangerous.

First, I assume you mean awk command in the generic sense, rather than command awk literally (which does something entirely different).

If the awk script fails for...
Showing results 1 to 25 of 35

 
All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy