Search Results

Search: Posts Made By: Anupam_Halder
1,274
Posted By Don Cragun
Have you tried comm?
Have you tried comm?
1,425
Posted By Don Cragun
This is posted in the Shell Programming and...
This is posted in the Shell Programming and Scripting forum, but the way you are invoking your functions looks like you want to write a C function (except for using single quotes instead of double...
1,184
Posted By SriniShoo
awk 'NR == FNR{a[$1] = $2; next} {for(x in a)...
awk 'NR == FNR{a[$1] = $2; next}
{for(x in a)
{gsub(x, a[x])};
print}' S_CHAR.cfg TEST.out
1,184
Posted By SriniShoo
awk 'NR == FNR{a[$1] = $2; next} {for(x in a)...
awk 'NR == FNR{a[$1] = $2; next}
{for(x in a)
{gsub(x, a[x])}; gsub(/\\/, X);
print}' S_CHAR.cfg TEST.out
2,858
Posted By blakeoft
Try this then: FOLDER="/nas/testfolder" ...
Try this then:

FOLDER="/nas/testfolder"
FILE=$(ls -alt ${FOLDER} | awk '$NF ~ /^Test/ {print $NF}' | head -1)
if [[ -z $FILE ]]
echo "No file name matches your pattern in $FOLDER"
else
...
2,858
Posted By SriniShoo
find /home/user/log -type f -name "*.log" | xargs...
find /home/user/log -type f -name "*.log" | xargs vdir --time-style="+%s" | awk -v d="$(date +%s)" '{printf "%s\t%d\n", $7, (d - $6)/60}'

You know what to change ;)
directory & file pattern in...
2,858
Posted By blakeoft
I think I have a fix for my code above. Try this:...
I think I have a fix for my code above. Try this:
FOLDER="/nas/testfolder"
FILE=$(ls -alt ${FOLDER} | awk '$NF ~ /^Test/ {print $NF}' | head -1)
FILE_TIME=$(date --reference=$FOLDER/$FILE +%s)...
2,858
Posted By blakeoft
Try this: ls -al | awk '$NF ~ /pattern/...
Try this:

ls -al | awk '$NF ~ /pattern/ {print $7,$8,$9}' | sort -rM | head -1Long list of all files in the current directory showing hidden files. Pipe to awk. If the last field (the file names)...
1,230
Posted By SriniShoo
find /user/home/log -type f -name "*.log" -mmin...
find /user/home/log -type f -name "*.log" -mmin -$((X * 60))

you can replace 'X' with number of hours, "/user/home/log" with the directory and "*.log" with your required file format
2,855
Posted By Yoda
I don't think OP want blank space to be escaped....
I don't think OP want blank space to be escaped. I don't see blank space escaped in OP's expected output.

I guess OP want to escape only those characters defined in variable SPECIAL_CHARS
2,855
Posted By RudiC
Try alsoawk -v X="& ;" -v E='\'...
Try alsoawk -v X="& ;" -v E='\' '{gsub(/./,"&|",X); sub (/.$/,"", X); gsub (X, "\\" E "&")}1' <<< 'abcd fkaj&dsdsd'
abcd\ fkaj\&dsdsdIf you know the escape char is back slash, this may work:
awk -v...
2,855
Posted By Yoda
Another approach: SPECIAL_CHARS='& ;' ...
Another approach:
SPECIAL_CHARS='& ;'
ESCAPE_CHAR='\'
echo 'abcd fkaj&dsdsd' | awk -v SC="$SPECIAL_CHARS" -v EC="$ESCAPE_CHAR" '
BEGIN {
n = split ( SC, A )
}
...
2,855
Posted By Akshay Hegde
Awk : $ echo "abcd fkaj&dsdsd" | awk...
Awk :
$ echo "abcd fkaj&dsdsd" | awk 'gsub(/[[:punct:]]|[[:space:]]/,"\\\\&")'
abcd\ fkaj\&dsdsd
2,855
Posted By Klashxx
Python re module maybe handy for that task: ...
Python re module maybe handy for that task:
echo "abcd fkaj&dsdsd;"|python -c 'import re;import sys;print re.escape(sys.stdin.read().strip()),'
2,855
Posted By kurumi
# echo "abcd fkaj&dsdsd" | ruby -e 's=gets; puts...
# echo "abcd fkaj&dsdsd" | ruby -e 's=gets; puts s.gsub(/([& ;])\1*/,"\\\\\\1")'
abcd\ fkaj\&dsdsd
2,855
Posted By Akshay Hegde
@ Yoda and RudiC Actually I am confused...
@ Yoda and RudiC


Actually I am confused about post1's example , whether example output is expected output / error in output / escape char missing output ?
1,305
Posted By bartus11
It will match any string that is at least 1 and...
It will match any string that is at least 1 and at most 50 character combination of following characters:


dash
lowercase alfanumeric characters
uppercase alfanumeric characters
4,949
Posted By Chubler_XL
This should be closer - replace the echo...
This should be closer - replace the echo statements with call to your processing function/script:

function period
{
date=${1:today}
period="$(date -d "$date" +"%d.%m.%u")"
[[ $period...
1,120
Posted By krishmaths
Can you paste the code here again? If there is...
Can you paste the code here again? If there is any space after the assignment "=" then you might have a problem.

You may also try if this works. Instead of assigning date to a variable simply have...
2,347
Posted By Don Cragun
The standards specify that options should come...
The standards specify that options should come before operands; not after. There are ways to work around that, but I don't see any real reason to bend the guidelines for what you're trying to do. ...
1,869
Posted By rbatte1
Depending on your OS flavour and version (please...
Depending on your OS flavour and version (please tell us - it does really help) you may be able to issue:-
date --set="today + 1 day"

I hope that this helps, but if not, a good search of these...
1,869
Posted By balajesuri
With GNU date: future=`date -d"+$x days"` ...
With GNU date:
future=`date -d"+$x days"`
past=`date -d"-$x days"`

Also, take a look at this link...
1,584
Posted By cero
I'd use the written out pathname of the users...
I'd use the written out pathname of the users homedirectory instead of the ~ notation.
1,584
Posted By panyam
What is the content of your script: ....
What is the content of your script:

. ~xcrukusr/.bash_profile_xcruk

?

It seems , $XCR_HOME and $XCR_CFG are not ( are unknown to cron which mean they are not defined )!!!
1,584
Posted By RudiC
(sigh) Did you ever bother to search...
(sigh) Did you ever bother to search (https://www.unix.com/faq.php?faq=pt_faq#faq_pt_faq_how_post) these fora? You might have come across the solution...
Showing results 1 to 25 of 46

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