Search Results

Search: Posts Made By: ctsgnb
8,029
Posted By jlliagre
Passing more than one file to the redirection...
Passing more than one file to the redirection wont be interpreted that way, the second file will just be understood as a command name.
$(< file1 file2)

Using more than one redirection lead to...
8,029
Posted By RudiC
It is. In fact, tr -dc etc. are interpreted as...
It is. In fact, tr -dc etc. are interpreted as input files
cat: tr: No such file or directory
cat: -dc: No such file or directory
cat: '[:alnum:],@#:!?+-': No such file or directory
and generate...
8,029
Posted By Scrutinizer
It does not work that way. $(<file) is a special...
It does not work that way. $(<file) is a special case, which is a faster alternative to $(cat file). If you are using anything other than just a file, it becomes something else. $( ... ) is just...
1,352
Posted By Don Cragun
In standard awk, just for < and > on string...
In standard awk, just for < and > on string operands. I believe gawk and some other versions of awk have extensions to the standards that provide built-in functions to sort arrays (which presumably...
1,352
Posted By Corona688
Oh, that's a new one on me. It looks like an...
Oh, that's a new one on me.

It looks like an internationalization feature, awk's equivalent of digraphs and trigraphs (https://en.wikipedia.org/wiki/Digraphs_and_trigraphs), multi-byte sequences...
34
78,164
Posted By bakunin
not quite: The difference is what "word" means....
not quite: The difference is what "word" means. "cw" (or any other command using "w" as a range assignment) will treat special characters as the end of the word, whereas "cW" will treat only...
4,374
Posted By Corona688
Perl is specifically designed to be binary-safe...
Perl is specifically designed to be binary-safe and have unlimited line lengths, is the thing. It's better suited to editing binary files than awk.

I bet it was the line lengths that were...
3,099
Posted By RudiC
How about sed 's/ //7g; s/DATA //p; 1s/^[^ ]*...
How about sed 's/ //7g; s/DATA //p; 1s/^[^ ]* //p; 2!d' file1
Date Name Age State
------------------------------------------------------------------------------------
12 Sep 2014 14:00 EST...
1,202
Posted By Don Cragun
Perhaps ed or ex would be simpler: ed -s file...
Perhaps ed or ex would be simpler:
ed -s file <<-"EOF"
g/Mamma/.-1,.+1d
1,$p
EOF
And, if you want to modify the input file instead of just print the file contents with the specified lines...
4,574
Posted By RudiC
I guess duplicate filenames means files in...
I guess duplicate filenames means files in different directories? Do you need the full path of the dupes? Then - if your version of find and uniq allow for it - use printf "%h %f %s\n"and uniq -d...
3,572
Posted By Don Cragun
Note that if an input file contains any empty...
Note that if an input file contains any empty lines (i.e., just a <newline> character), they will not appear in the output produced by the above command.

However, the command:
grep '^' *.txt >...
7,606
Posted By Scrutinizer
Nice. I found this about the use of + : ...
Nice.

I found this about the use of + :



ex: Rationale - options (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_18_01)

This seems to work too:
ex -sc...
7,606
Posted By Don Cragun
#!/bin/ksh infile="Input" outfile="Output" ...
#!/bin/ksh
infile="Input"
outfile="Output"
ed -s "$infile" <<-EOF
/Output view:/m0
w $outfile
q
EOF
This was tested using the Korn shell, but will work with any shell...
10,773
Posted By Kibou
Thanks so much. I have learned a lot. Here...
Thanks so much. I have learned a lot.

Here is the final version of the script. It works like a charm!

tempfile=$(mktemp -t XXXXXXXX.$$) || exit 1


(tail -f file | grep --line-buffered...
1,869
Posted By alister
ctsgnb's suggestion depends on shopt extglob...
ctsgnb's suggestion depends on shopt extglob being on. The history expansion error you're seeing means you have it off (nothing wrong with that).

Regards,
Alister
1,488
Posted By MadeInGermany
BTW Unix sed wants the ^ anchor outside the \(...
BTW Unix sed wants the ^ anchor outside the \( \):
echo 1234567890 | sed 's/\(^.....\).../\1KUMARJIT/'
1234567890
echo 1234567890 | sed 's/^\(.....\).../\1KUMARJIT/'
12345KUMARJIT90and is IMHO...
15,894
Posted By Don Cragun
You will usually find that this forum can provide...
You will usually find that this forum can provide much better help and provide it sooner, if you state all of the requirements up front. When you hide some of the requirements (or add on new...
18,423
Posted By Scrutinizer
Yes the $1=$1 trims the blanks, so that we can be...
Yes the $1=$1 trims the blanks, so that we can be sure there is no leading whitespace and and only a single space separating the fields, so that the subs can be successful..


For example:
$...
18,423
Posted By Scrutinizer
@cts. bala@ the difference occurs not because of...
@cts. bala@ the difference occurs not because of awk versions but because you are using different different data samples. With bala's data sample this part of ctsgnb's code is problematic:...
26,752
Posted By Scott
You said that, but didn't mention what 'distro'...
You said that, but didn't mention what 'distro' you are on... ;)
2,936
Posted By Scrutinizer
Thread was merged because there was a double...
Thread was merged because there was a double thread...
3,388
Posted By alister
Without seeing the code, I have no idea what...
Without seeing the code, I have no idea what you're trying to accomplish and what the implementation looks like. You're unlikely to receive any useful advice if you don't share the shell and python...
2,176
Posted By alister
The suggestions mentioned below are all incorrect...
The suggestions mentioned below are all incorrect for reasons stated in post #3.



Incorrect numeric comparison. Numerically, 1.10 is less than 1.9, but as a version number, 1.10 is greater than...
3,457
Posted By Scrutinizer
awk '{$1=$1}NF=NF>2' RS=/ infile Some awks: ...
awk '{$1=$1}NF=NF>2' RS=/ infile

Some awks:
awk 'NF=NF>2' RS=/ infile
3,716
Posted By Scrutinizer
NaN (="Not a Number") can be a special value...
NaN (="Not a Number") can be a special value POSIX Floating Point Problems - The GNU Awk User's Guide (http://www.gnu.org/software/gawk/manual/html_node/POSIX-Floating-Point-Problems.html) , so this...
Showing results 1 to 25 of 83

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