Search Results

Search: Posts Made By: sand1234
4,105
Posted By Chubler_XL
the first < is a standard input redirection and...
the first < is a standard input redirection and causes input to the read command to come from a file.

The second part is process substitution witch takes the format of <(list). The value list...
4,105
Posted By Chubler_XL
This is because commands within a pipeline are...
This is because commands within a pipeline are run in subshells so the read statement is setting the variables is a subshell which has not impact on the main shell.

You can achieve what you want...
1,651
Posted By RudiC
Try posting runnable, syntax error free code only...
Try posting runnable, syntax error free code only so people can concentrate on the logical problems. I won't comment on the obvious errors in your incomplete code snippet above. How about
awk '...
2,404
Posted By RavinderSingh13
Hello sand1234, Following is the complete...
Hello sand1234,

Following is the complete explanation on same.

awk ' ##Starting awk command here.
{
ORS=length==80?"":RS ##Setting ORS by checking condition if...
2,404
Posted By RavinderSingh13
Hello sand1234, Here is the explanation of...
Hello sand1234,

Here is the explanation of it:

As you could see there are 2 %s written in printf which are connected to following.

%s -----> length($0)==80?ORS:""
%s -----> $0

1st one...
2,404
Posted By RavinderSingh13
Hello sand1234, Could you please try...
Hello sand1234,

Could you please try following(not tested though).

awk '{printf("%s%s",length($0)==80?ORS:"",$0)} END {print ""}' unwrap2.txt


Thanks,
R. Singh
2,404
Posted By RavinderSingh13
Hello sand1234, When I ran code for your...
Hello sand1234,

When I ran code for your samples it worked fine for me, if still it is giving no new line at last edit it like:

awk '{printf("%s%s",$0~/^[0-9]+/ &&...
2,404
Posted By RudiC
Try also (your code simplified): awk...
Try also (your code simplified):
awk 'length==80 {ORS=""} 1; {ORS=RS}' fileor
awk '{ORS=length==80?"":RS} 1' file

Your first attempt doesn't work as expected as ORS is never reset to RS, as...
22,337
Posted By MadeInGermany
The duplicates are removed because of the...
The duplicates are removed because of the associative (string-indexed) array o[ ].
If the string $(NF-1) occurs the second time it defines the same array element again.
You can make it visible by...
22,337
Posted By MadeInGermany
Sorry, in my first sample the .* (capture any...
Sorry, in my first sample the .* (capture any characters) was wrongly at the end, belongs to the beginning.
You can add a second substitution, the trick is the order.
sed -n 's# *[(].*##; s#.* =>...
22,337
Posted By Don Cragun
There are a few reasons why your original sed...
There are a few reasons why your original sed script can't work.

Your first asterisk in your RE needs a period before it.
There is nothing in your script to avoid printing lines that do not...
22,337
Posted By MadeInGermany
The sed expression should be in quotes, so the...
The sed expression should be in quotes, so the shell does no substitutions on special characters.
sed -n 's#\(/lib\).*#\1#p'
Or
sed -n 's#.* => ##p'
3,571
Posted By balajesuri
grep -P -B 10 -A 9 'Status: ...
grep -P -B 10 -A 9 'Status: (?!Clear)' alarm.txt
2,726
Posted By RudiC
Yes No. It's used as printf's "format...
Yes

No. It's used as printf's "format string" to be used for variable counter



YES, be aware of the strike through.

[QUOTE]However I cannot understand why we need counter+=NF in this...
2,726
Posted By RudiC
Try awk '{printf "%04x %s\n", counter, $0;...
Try
awk '{printf "%04x %s\n", counter, $0; counter += NF}' file
0000 84 78 ac 54 99 e4 bc 05 1d a2 00 62 00 c0 a2 00
0010 00 fc 00 0c 29 15 6c c6 a8 9d 21 93 2b 90 81 00
0020 02 6c 08 00 45 00...
5,050
Posted By RudiC
Yes, man awk, amongst others: It is a standard...
Yes, man awk, amongst others:
It is a standard feature of awk for both print and printf.
5,050
Posted By RudiC
Not with a single input source piped into...
Not with a single input source piped into something. Note that you open and read test.txt twice in your above construct. You could do (but this is far from being smart nor efficient)


cat...
5,050
Posted By RudiC
Not sure what you're after. Header plus a sorted...
Not sure what you're after. Header plus a sorted list of the residual lines? How about
docker image ls | awk 'NR==1 {print; next} {print | "sort -Vrk5"}' Be aware that sort sees the...
2,760
Posted By MadeInGermany
x < y means: run command x and feed its input...
x < y means: run command x and feed its input (stdin) from file y.
It is true that file y is opened for reading before command x runs.
diff <(sort testfile.txt) <(sort testfile2.txt) means: open a...
140,952
Posted By vgersh99
awk -F":" -v OFS=',' '{print $1, $2, 9}'...
awk -F":" -v OFS=',' '{print $1, $2, 9}' fname
2,232
Posted By vgersh99
something along these lines: sed 's/^...
something along these lines:

sed 's/^ *\([0-9][0-9]*\).*\(TSval.*\)/\1 \2/' myFile

1> Why does [0-9] need to be grouped into brackers?
[0-9] - signifies the character rang - in this case...
3,358
Posted By Scrutinizer
See post #5. It is the difference between...
See post #5. It is the difference between numerical and version number sort..

With version numbers 1.11 comes after 1.9. With numerical sort 1..11 is smaller than than 1.9 .

You had not...
Showing results 1 to 22 of 22

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