Search Results

Search: Posts Made By: gigagigosu
Forum: OS X (Apple) 02-10-2017
1,765
Posted By Corona688
A version using awk: find /Archive -f -name...
A version using awk:

find /Archive -f -name 12345.pdf -printf "%T@ %p\n" | awk '$1 > P { P=$0 } ; END { $0=P ; $1=""; print substr($0,2) }'
Forum: OS X (Apple) 02-10-2017
1,765
Posted By Corona688
find /Archive -f -name 12345.pdf -printf "%T@...
find /Archive -f -name 12345.pdf -printf "%T@ %p\n" | sort -rn | head -n 1

This will prepend a date in epoch seconds to every file name, which sort can order by time.
Forum: OS X (Apple) 02-06-2017
2,101
Posted By Scrutinizer
Try: $ s=J1705PEAN038TDMN $ echo...
Try:
$ s=J1705PEAN038TDMN
$ echo "${s##*[!0-9][0-9][0-9][0-9]}"
TDMN

--
If it does not need to be exactly 3 digits, but 3 or more digits then you could try:
echo "${s##*[0-9][0-9][0-9]}"
Forum: OS X (Apple) 02-06-2017
2,101
Posted By vgersh99
echo 'J1705PEAN038TDMN' | sed 's/.*[0-9]//' ...
echo 'J1705PEAN038TDMN' | sed 's/.*[0-9]//'
---------- Post updated at 03:53 PM ---------- Previous update was at 03:53 PM ----------


having a sample file would help. Identifying a field to be...
Forum: OS X (Apple) 02-06-2017
2,101
Posted By Corona688
$ echo "J1705PEAN038TDMN" | grep -o...
$ echo "J1705PEAN038TDMN" | grep -o "[0-9][0-9][0-9][^0-9]*$"

038TDMN

$ VAL=$(echo "J1705PEAN038TDMN" | grep -o "[0-9][0-9][0-9][^0-9]*$")
$ VAL=${VAL:3}
$ echo $VAL

TDMN

$

There's...
Forum: OS X (Apple) 01-20-2017
1,465
Posted By RudiC
Not sure if this will work on more sophisticated...
Not sure if this will work on more sophisticated file structures:
awk '{sub (/\n"/, _)} 1' RS= file
line 1
line 2line 3

For your new request, try
awk '{gsub (/\n *"/, _)} 1' RS= file
Forum: OS X (Apple) 01-20-2017
1,465
Posted By Corona688
$ awk '/^"/ { print L substr($0,2) ; L="" ; C=0;...
$ awk '/^"/ { print L substr($0,2) ; L="" ; C=0; next } { if(C) print L ; L=$0 ; C=1 } END { if(C) print L }' inputfile

line 1
line 2line 3

$ I'll need more details on the newline carriage...
2,146
Posted By Corona688
If you take the question literally, then no. The...
If you take the question literally, then no. The shell has to change its own directory, nothing from the outside can force it to change. Any external program will have its own, separate, current...
2,146
Posted By jim mcnamara
Yes. IF you source a script it runs in the...
Yes. IF you source a script it runs in the conext of the current process rather than as a child

two ways

# bash source command
source myscript.sh
# standard for other shells
. myscript.sh
3,934
Posted By binlib
expr 1234_v2_abcd : '.*_v.'
expr 1234_v2_abcd : '.*_v.'
3,934
Posted By yazu
echo 1234_v2_abcd | perl -lne 'print(index($_,...
echo 1234_v2_abcd | perl -lne 'print(index($_, "_v")+2)'
Or if +3 if you count position from 1.
12,453
Posted By Chirel
Hi, Just search this on the forum before...
Hi,

Just search this on the forum before asking (https://www.unix.com/shell-programming-scripting/23859-how-get-weekday-given-date.html) :)
3,802
Posted By Corona688
You can't help unwanted things splitting on...
You can't help unwanted things splitting on spaces when your list is separated by spaces.

Most here could have suggested that if you'd posted your complete script, or at least what your actual...
3,802
Posted By alister
Why not simply do the following instead? ...
Why not simply do the following instead?
source_folder=/my_files
/Scripts/Combine_PDFs_python.py -o /TEST`date +%H-%M-%S`.pdf "$source_folder"/*

Pathname expansion, which expands the asterisk...
3,802
Posted By alister
There is no quote removal done on the results of...
There is no quote removal done on the results of parameter expansion. The file names seen by the python script in this case include those quotes.



In this example, the shell will remove those...
1,055
Posted By ctsgnb
# echo "sdgfj ghjsdgfjhds11.xml" | sed...
# echo "sdgfj ghjsdgfjhds11.xml" | sed 's/.*\(.....\)\..*/\1/'
hds11
t=${a%?????.xml};b=${a##$t};echo "${b%%.*}"
# a="sdgfj ghjsdgfjhds11.xml"
# echo $a
sdgfj ghjsdgfjhds11.xml
#...
168,546
Posted By Perderabo
Days Elapsed Between 2 Dates
We really don't (yet) have a posting that addresses the general problem of number of days between two dates. So I have just finished what should be the last date calculation script that I ever...
Showing results 1 to 17 of 17

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