Search Results

Search: Posts Made By: mjf
750
Posted By mjf
Here is one way: $ echo '0 2 4 6 7 0 0 0 0' |...
Here is one way:
$ echo '0 2 4 6 7 0 0 0 0' | sed 's/0/\n/g; s/\n/0/; s/\n//g'
0 2 4 6 7
1,128
Posted By mjf
boaz733, See this link on several different...
boaz733,
See this link on several different solutions for printing lines between 2 strings:
...
2,362
Posted By mjf
If your flavor of Unix supports uniq with -D...
If your flavor of Unix supports uniq with -D option, this should meet your requirement of listing all duplicate file names ignoring the first 26 characters.

ls | sort -t'.' -k8,9 | uniq -s 26 -D
2,937
Posted By mjf
Using sort: sort -m -u -k 2,6 1 20 30 40...
Using sort:

sort -m -u -k 2,6
1 20 30 40 50 60 6
4 30 40 50 60 70 8
2,362
Posted By mjf
You can try something like this: find . |...
You can try something like this:

find . | awk -F"/" '{print $NF}' | sort | uniq -d > dupfiles.txt You can do a second sort as the output is not in the required order.
3,054
Posted By mjf
How about including your code so we can review...
How about including your code so we can review and help you out?
966
Posted By mjf
You could try something like this: FOR %i IN...
You could try something like this:

FOR %i IN (new*_3*.txt new*_4*.txt new*_5*.txt) DO find %i /c /v ""Do you have Power Shell or Cygwin?
1,209
Posted By mjf
Try using a FOR loop: FOR %i IN (sec*.txt) DO...
Try using a FOR loop:
FOR %i IN (sec*.txt) DO find %i /c /v ""
1,676
Posted By mjf
How about something like this? nawk -F'[ =]'...
How about something like this?

nawk -F'[ =]' 'FNR==NR{a[$2$3]++;next}!a[$1$2]' file1.txt file2.txt
1,933
Posted By mjf
abhiabhi, 1. You say there are 5.txt files...
abhiabhi,

1. You say there are 5.txt files in d1 directory, but you have *dat as well? Are these files being zipped as expected?
2. Can you list contents of d1 before and after you run gzip?
3....
4,052
Posted By mjf
find . -type d Searches for directories...
find . -type d
Searches for directories recursively starting from current folder.

\( -name archive -o -name log \) -prune
If directory is named archive or log then remove (prune) it from...
8
1,892
Posted By mjf
Xterra, What do you mean by better way? Most...
Xterra,

What do you mean by better way? Most efficient? The shortest or most cryptic? Your solution appears to work based on your input/output after implementing #2 and #4 in my last post and is...
8
1,892
Posted By mjf
Xterr, Couple of things: 1. Not sure what...
Xterr,
Couple of things:

1. Not sure what your original code was before you edited it as your updated code is identical.
2. There is a space in the first position of each line on your input file...
2,315
Posted By mjf
Take a look at -l option in grep. For...
Take a look at -l option in grep.

For example:
grep -l keyword $DIRECTORY/*.log
1,279
Posted By mjf
Don, I completely missed that subtlety on...
Don,
I completely missed that subtlety on substring matches!

This solution appears to work as well:

$cat all_data.txt ...
1,279
Posted By mjf
Take a look at the below link for at least one...
Take a look at the below link for at least one approach you can take:

https://www.unix.com/shell-programming-and-scripting/253985-match-no-match.html
2,084
Posted By mjf
MadeInGermany, Thanks for the tip, however,...
MadeInGermany,
Thanks for the tip, however, based on the requirement, the check to see if the variable exists in the array needs to be negated:

nawk 'FNR==NR{map[$1];next} !($18 in map)'...
2,084
Posted By mjf
Good, you're welcome. But have you looked at...
Good, you're welcome. But have you looked at identifying these records (or the next ones that you might load) that failed at insert time? Or perhaps this was a one time load and not something you...
2,084
Posted By mjf
Try sometrhing like this: $nawk...
Try sometrhing like this:

$nawk 'FNR==NR{map[$1]=$0;next} !map[$18]' import.txt all.txt
1 1 20152005 630 admin NULL NULL NULL NULL NULL NULL ...
2,084
Posted By mjf
cmccabe, I'm having trouble making out the...
cmccabe,
I'm having trouble making out the lines on the smaller file you attached (the other one is 87.7mb). Can you attach smaller exmaple files? Also, can you show your expected results and the...
2,922
Posted By mjf
Don, I interpreted the data Saravanan_0074...
Don,
I interpreted the data Saravanan_0074 included in his/her last post to be the output, not the input, of running the awk command (in which case you would need-F'|'and NR>2). The avg of 26.2439...
2,922
Posted By mjf
How about removing the hour? awk -F'|'...
How about removing the hour?

awk -F'|' 'NR>2 {array[$1] += $3 count[$1]++ } END { for (a in array) {print a, array[a]/count[a] } } '
3,592
Posted By mjf
Take a look at sed command.
Take a look at sed command.
2,922
Posted By mjf
Got it! I need to dust off my old college C books.
Got it! I need to dust off my old college C books.
2,922
Posted By mjf
I understand the concatenation but what I'm not...
I understand the concatenation but what I'm not getting is why the extra digits being added are off by one for each line. For example, for line 3, I would expect the extra digit in red to be 1...
Showing results 1 to 25 of 169

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