Search Results

Search: Posts Made By: member2014
4,399
Posted By Corona688
It's also important to realize that parallel can...
It's also important to realize that parallel can be a performance loss in some situations, especially if any of these queries are disk-intensive.
4,399
Posted By Neo
Please show your own work and any scripts /...
Please show your own work and any scripts / programs you have written so far to accomplish your task; and any error messages you got.
1,520
Posted By Chubler_XL
Nice pickup on the number of digits RadiC, must...
Nice pickup on the number of digits RadiC, must have miscounted there.

I'm fairly sure that -q will exit on first matching record so -m 1 will not add any more efficiency.
1,520
Posted By RudiC
In Chubler_XL's proposal, 8 digits should be...
In Chubler_XL's proposal, 8 digits should be checked, and you could stop after the first invalid entry, saving some time on large files:if grep -qvEm 1 '^.{5}[0-9]{8}' inputfile.txt
1,520
Posted By rbatte1
If you are reading the file in line by line in a...
If you are reading the file in line by line in a loop, you could add this type of thing too:-i=0
while read col1 col2 col3 col4 col5
do
((i=$i+1))
if [ "${#col3}" -ne 8 ]
then
...
1,520
Posted By Chubler_XL
Not sure what output you are after. Here I...
Not sure what output you are after. Here I report if file contains any invalid rows:

if grep -qvE '^.{5}[0-9]{6}' inputfile.txt
then
echo "File is invalid"
else
echo "File is valid or...
3,395
Posted By RudiC
OK. Why didn't you specify that in the first...
OK. Why didn't you specify that in the first place?

Try sed 's/./&,/18;s/./&,/9;s/./&,/4;s/ *,/,/g' file
3,395
Posted By Scrutinizer
GNU awk: awk '{sub(/ *$/,x,$5); print...
GNU awk:
awk '{sub(/ *$/,x,$5); print $1,$3,$5,$7}' FIELDWIDTHS="1 3 4 1 8 1 3" OFS=, file

I,0515,MR,394
I,0618,MR & MRS,942
I,0618,MR & MRS,944
I,0205,MR & MRS,614
I,0122,MR,940
3,395
Posted By RudiC
Try sed 's/./,/4;s/./,/9;s/./,/18;s/ *,/,/g' file...
Try sed 's/./,/4;s/./,/9;s/./,/18;s/ *,/,/g' file
I,0515,MR,394
I,0618,MR & MRS,942
I,0618,MR & MRS,944
I,0205,MR & MRS,614
I,0122,MR,940
3,395
Posted By Yoda
How about using awk instead? awk '{print...
How about using awk instead?
awk '{print substr($0,1,1), substr($0,5,4), substr($0,10,8), substr($0,19)}' OFS=, test_fixed_len.txt
11,719
Posted By derekludwig
Use sed: sed -e 's/|[^|]*|/|/' ----------...
Use sed:
sed -e 's/|[^|]*|/|/'

---------- Post updated at 02:12 PM ---------- Previous update was at 01:58 PM ----------

Or cut:
cut -d\| -f1,3-
1,781
Posted By RudiC
OK, make it ls *.txt.* | awk ...
OK, make it ls *.txt.* | awk ...
9,463
Posted By vbe
&& is Not an AND operator... Its meaning is: ...
&& is Not an AND operator... Its meaning is: if TRUE( the previous test...) execute what follows, and so it make that line a true one liner. ( the contrary would be || )
9,463
Posted By junior-helper
Referring to the bash manpage, && is a "control...
Referring to the bash manpage, && is a "control operator":
AND and OR lists are sequences of one of more pipelines separated by
the && and || control operators, respectively. ...
9,463
Posted By Chubler_XL
Apologise that percent sign has special meaning...
Apologise that percent sign has special meaning in the crontab file (It's use to insert a newline) and will need to be escaped your entry should look like this:

0 9 22-31 8 * [ $(date +'\%w') -eq...
9,463
Posted By vbe
Run it on tuesdays and test if the date is...
Run it on tuesdays and test if the date is 15-21...
9,463
Posted By Chubler_XL
You could also run it each month on 15th to 21st...
You could also run it each month on 15th to 21st and check if it's a Tuesday.

Here I've done the check in the crontab entry, which is nice if you would like to run the script manually and the day...
1,686
Posted By Don Cragun
Standard POSIX parameter expansions do everything...
Standard POSIX parameter expansions do everything you seem to want here:
#!/bin/ksh
while read base e1 e2
do touch "${base%.*}${e1:+.$e1}${e2:+.$e2}.finished"
done < ListFile.txt
${base%.*} will...
1,686
Posted By Akshay Hegde
Using awk [akshay@nio tmp]$ cat file ...
Using awk

[akshay@nio tmp]$ cat file
test1.sh
test2.sh PC1
test3.sh PC2 PC21
test4.sh
test5.sh PC3
test6.sh PC4 PC41

[akshay@nio tmp]$ awk '{sub(/\..*/,x,$1); $1=$1; $NF=$NF".finished";...
1,686
Posted By rbatte1
These are much easier to do with variable...
These are much easier to do with variable substitution. It sounds hard to get started, but it's easier when you get the hang of it.

Is SCRIPT_NAME a value you will read as input or do you want it...
1,836
Posted By Corona688
Windows expects lines to end with \r\n. Since...
Windows expects lines to end with \r\n. Since the logfile is encoded, the mere act of emailing it doesn't fix this. You can add carriage returns to a file with sed 's/$/\r/' < inputfile > outputfile
3,103
Posted By Aia
If you have egrep supporting the -o option the...
If you have egrep supporting the -o option the following snippet might do it:

egrep -o '\w*.lst' List1 | xargs cat >> big.list
3,103
Posted By Don Cragun
I don't understand why any grep is needed here???...
I don't understand why any grep is needed here???

I also don't understand why you don't want:
test2.ksh
test3.ksh
in your output file in addition to what you have said you want?

But, to get...
2,341
Posted By Aia
Test it awk -v fc=$feed_cnt 'NR==FNR {...
Test it

awk -v fc=$feed_cnt 'NR==FNR { f[$0]++; next } $0 in f { total += f[$0] }; END { if (total > (0.02 * fc)) print "Errors exceed the tolerance level" }' $err_log $err_list
2,341
Posted By Don Cragun
There are several issues here. What...
There are several issues here.

What operating system are you using?
What shell are you using?
What errors are you getting from your script?
Is err_list the name of a file, or is it the name...
Showing results 1 to 25 of 25

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