Search Results

Search: Posts Made By: rosebud123
2,427
Posted By rbatte1
Without seeing the error message you got, it's...
Without seeing the error message you got, it's difficult to diagnose, however:-
If there are lots of files, your use of -name * unquoted may have expanded for each file so much that you exceeded...
2,427
Posted By bakunin
I take it you want to leave all the directories...
I take it you want to leave all the directories intact, yes? Otherwise a simple rm -rf would suffice.

find . -name \* -type f -exec rm -f {} \;

Since you are not interested in the name of the...
2,427
Posted By MadeInGermany
By default find descends into all subdirectories....
By default find descends into all subdirectories.
The -prune is for NOT descending. For example
find . \! -name . -prune -type f -exec rm -f {} +
sets the prune flag for all directories but the...
12,586
Posted By Peasant
awk -F"|" 'NR>1 { a[$0]=$7 } END { for ( i in a )...
awk -F"|" 'NR>1 { a[$0]=$7 } END { for ( i in a ) print i > "1_"a[i] } ' input


If you have gigabyte files, a different approach would be needed to minimize memory usage, since array a would...
12,586
Posted By RudiC
A bit simpler, no memory hogger: awk -F\|...
A bit simpler, no memory hogger:


awk -F\| 'NR>1 {if (!X[$7]) X[$7] = ++CNT; print > (X[$7] "_" $7)}' file


If you have a large number of different output files (exceeding system limits)...
7,493
Posted By RudiC
a) appending / prefixing the actual file name to...
a) appending / prefixing the actual file name to the output file name would be way easier than inserting into the yn string. Try f=a FILENAME etc. If not happy with this, construct the f variable...
7,493
Posted By Scrutinizer
Try and adjust something like: awk...
Try and adjust something like:
awk '{y=substr($2,1,4); f=b} y<lt{f=a} y>gt{f=c} {print>f} ' lt=2017 gt=2018 a=y1 b=y2 c=y3 infile
This should split the input file into the files y1, y2 and y3.
4,543
Posted By RudiC
Howsoever, try while read T do ((CNT++))...
Howsoever, try
while read T
do ((CNT++))
for ((i=0; i<${#T}; i++))
do LC_ALL=C TMP=$(printf "%d\n" "'"${T:i:1})
[ $TMP -gt 127 ] && printf "%d %c %d\n"...
4,543
Posted By wisecracker
Hi rosebud123... This is a working model. ...
Hi rosebud123...

This is a working model.
I have used the '/tmp' directory for ease of testing.
READ THE NOTES INSIDE THE CODE!
#!/bin/bash
while read T
do ((CNT++))
for ((i=0;...
Showing results 1 to 9 of 9

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