Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: ctsgnb
1,327
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...
1,327
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...
1,327
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...
927
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...
927
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
62,928
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...
2,838
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...
2,093
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...
875
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...
2,375
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...
2,166
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 >...
3,979
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...
3,979
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...
8,995
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,430
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,151
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...
10,967
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...
15,533
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:
$...
15,533
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:...
19,802
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,344
Posted By Scrutinizer
Thread was merged because there was a double...
Thread was merged because there was a double thread...
2,836
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...
1,847
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...
2,865
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
2,494
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

 

Featured Tech Videos

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