Search Results

Search: Posts Made By: cmf1985
1,722
Posted By cmf1985
Maybe instead of for use a while, like so: ...
Maybe instead of for use a while, like so:


cat mylist | while read line
do
echo "Next file is: $line"
done
1,326
Posted By cmf1985
Try this: awk -va=0 -vb=0 '{if (NR!=1)...
Try this:


awk -va=0 -vb=0 '{if (NR!=1) {b=b+$NF-a}; if (NR==1) {print $0,b} else {print $0,b}; a=$NF;}' file.txt


---------- Post updated at 06:19 PM ---------- Previous update was at 06:17...
1,265
Posted By cmf1985
Maybe try this (I don't think elsif works in...
Maybe try this (I don't think elsif works in awk):

awk '{for(i=1; i<NF; i++) {if(($i-$(i+1)) < -10) {printf "-2 "} else if(($i-$(i+1)) > -10 && ($i-$(i+1)) <0) {printf "-1 "} else if(($i-$(i+1))>0...
2,149
Posted By cmf1985
You could try a script like this (replace...
You could try a script like this (replace /path/to/file with the actual path to the file you are grepping for errors):


#!/bin/bash

no_errors=`grep -c "Error due to syntax" /path/to/file`
...
3,028
Posted By cmf1985
You might try this, however it will not echo the...
You might try this, however it will not echo the "Overwrite previously saved":

grep '#' /diff_dir/outfile | awk -F'#' '{print $NF}' | awk -F':' '{print $NF}'
5,748
Posted By cmf1985
I guess you can't have nested backticks (`) and...
I guess you can't have nested backticks (`) and probably this is why it's throwing those errors.

You could try $() instead of ``, as in:


X=`cal $(date +%m) $(date +%Y) | grep -v '[A-Za-z]' |...
3,021
Posted By cmf1985
This will work also (obviously not as short...
This will work also (obviously not as short written as Franklin52's solution):


#!/bin/bash

#TARGET dir should end with /, as in /home/user/

TARGET="/your/dir/"...
15,012
Posted By cmf1985
Because I didn't know about the basename command?...
Because I didn't know about the basename command? :D

But you're right, it's the best for this task, since this is what it's designed to do.

Thanks for the heads up.
15,012
Posted By cmf1985
Or with awk: ...
Or with awk:


X="/TEMP_REGRESSION/regression/TESTSUITE/TestCases/Test1201/ext_libs/DATA/INTERNAL/pad_ext.lef"

echo $X | awk -F'/' '{print $NF}'
9,782
Posted By cmf1985
I'm beginning to get a bit confused about what...
I'm beginning to get a bit confused about what you want... Do you want to have the same files on the mail server and the backup server (as in, get a list of all the files currently on the mail server...
5,484
Posted By cmf1985
If your system supports the -A option for grep,...
If your system supports the -A option for grep, you could try something like this (I'm assuming that the records are stored in a file called file.txt, which does not contain the actual header...
9,782
Posted By cmf1985
coolatt, if I'm reading this right, you want to...
coolatt, if I'm reading this right, you want to delete from the backup server, for each xyz,2* group, all but the most recent file pertaining to each group.

I recreated your directory with the...
4,430
Posted By cmf1985
Or in a perhaps more familiar way, you could try...
Or in a perhaps more familiar way, you could try something like this:



> file3.txt

cat file1.txt | while read line
do
occurences=`grep -c "$line" file2.txt`
echo "$line...
Showing results 1 to 13 of 13

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