Search Results

Search: Posts Made By: ginrkf
2,556
Posted By RudiC
Same principal approach as bakunin's, but mayhap...
Same principal approach as bakunin's, but mayhap a bit less resource consuming (no cat nor echo (i.e. opening time stamp file twice), just file system (meta data) operation, running date just once),...
2,556
Posted By bakunin
This is an example of what is called...
This is an example of what is called "inter-process communication" because one process (the program to be started) needs some information of another process (the last instance of the program and when...
1,777
Posted By Ralph
The problem is that you use -a outside the...
The problem is that you use -a outside the brackets. The -a and -o operators belong to the test/[ ] command and can't be used outside. Then on the right side you use the || inside the brackets but...
1,777
Posted By Scrutinizer
Hi, in bash, try: if [[ $run == 1 && ( -f...
Hi, in bash, try:
if [[ $run == 1 && ( -f /tmp/start.Lck || -f /tmp/stop.Lck ) ]]

There should be no space between the double brackets.
1,370
Posted By RudiC
/is running/ doesn't match is Running.
/is running/ doesn't match is Running.
1,183
Posted By rbatte1
Maybe I'm being thick, but what is the ls -lrt | ...
Maybe I'm being thick, but what is the ls -lrt | for? I don't see it having any purpose the way it is coded. You need to quote $z when you use it to preserve the whitespace too.

If you want to...
1,183
Posted By apmcd47
I agree with MadeInGermany with one caveat: You...
I agree with MadeInGermany with one caveat: You are being precise with the number of characters in the date segments of the filename, and then blowing it with the spaces. Your pattern would match...
1,183
Posted By cero
The pipe feeding the loop does nothing useful...
The pipe feeding the loop does nothing useful because the filenames are picked by matching the pattern you give after in with the content of your current directory.
Arguments for commands and...
1,653
Posted By Don Cragun
And if the filenames always contain an 8 digit...
And if the filenames always contain an 8 digit date followed by an underscore and a 4 digit time (YYYYMMDD_hhmm) and the desire is to sort on the date and time, you could try:
ls | sed...
1,653
Posted By Scrutinizer
Try something like: ls | sed...
Try something like:
ls | sed 's/.*\([0-9]\{8\}\)/\1 &/' | sort -k1,1n | cut -c10-

This assumes that 8 digits always constitute a date..


--
If the date is always followed by an underscore...
1,555
Posted By kshji
Multiple file testing like rbatte1 tried to tell,...
Multiple file testing like rbatte1 tried to tell, if you need only know if some while include something.

found=0
for f in A*.rej
do
[ ! -s "$f" ] && continue
found=1
break
done
[...
1,555
Posted By Chrismcq
This will work :- found=0 if [ -s A123.rej...
This will work :-

found=0
if [ -s A123.rej ]
then
found=1
fi

if [ -s A345.rej ]
then
found=1
fi

if [ $found = 0 ]
then
echo "No Data"
else
echo "Data found"
fi
1,555
Posted By rbatte1
You could also try the following:-[ $(wc -l...
You could also try the following:-[ $(wc -l A*.rej | tail -1) = "0 total" ] && echo "No data" || echo "Data"...... or for each individual file:-for file in A*.rej
do
[ -s "$file" ] && state="no...
1,555
Posted By RudiC
That specification still is not that easy to...
That specification still is not that easy to understand. "No Data" seems not to be equivalent to "empty file", so the -s primary in the conditional expression can't be used. Aside: -s requires one...
1,038
Posted By Don Cragun
If you invoke your script with two parameters...
If you invoke your script with two parameters where the 1st parameter is the field separator and the 2nd parameter is the expected number of fields, just using:
awk -F "$1" -v cnt="$2" 'NF!=cnt...
871
Posted By RudiC
Try awk -F'|' ' NR == 1 {n = split (FLDS,...
Try
awk -F'|' '
NR == 1 {n = split (FLDS, ARRX, ",")
}

{IX = ""
for (i=1; i<=n; i++) IX = IX FS $ARRX[i]
}

!x[IX] {x[IX] = $0
L[IX] = 1
...
3,960
Posted By RavinderSingh13
Hello grinkrf, Could you please try...
Hello grinkrf,

Could you please try following too once and let me know if this helps you.
You could dynamically put as per file like whichever field you want to check.

awk -F"," 'function...
13,306
Posted By Scott
A semi-colon is missing: $ sed...
A semi-colon is missing:

$ sed '/^.AR/{s/AR/yyy/; s/.$//;}' f01
13,306
Posted By durden_tyler
I created a file with your posted data. Two...
I created a file with your posted data. Two things to note here:
(1) I replaced all spaces by "*" so they are easily visible.
(2) The length of each line is 24. It wasn't so in your post, but I...
13,306
Posted By MadeInGermany
This replaces position 2-3 with yyy, shifting the...
This replaces position 2-3 with yyy, shifting the remainder by +1
sed 's/\(.\{1\}\)../\1yyy/'
Showing results 1 to 20 of 20

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