Search Results

Search: Posts Made By: gnnsprapa
12,294
Posted By ctac_
You can try this way # Get parameters from...
You can try this way
# Get parameters from command line
while getopts "b:r:w:f" opt; do
case "$opt" in
b)
BankName=${OPTARG}
;;&
r)
Region=${OPTARG}
...
2,389
Posted By Don Cragun
The following should give you what you want even...
The following should give you what you want even if the filename contains white-space characters:
printf '%s\n' "$f" | awk -F'[-_]' '{print substr($0, 1, length($1$2$3$4$5)+4)}'
Note that echo on...
2,389
Posted By Scrutinizer
Then it should work:$...
Then it should work:$ f=010020001_S-FOR-Sort-SYEXC_20180109_062320_0100.x937
$ echo "${f%_*_*_*}"
010020001_S-FOR-Sort-SYEXC
$ echo "${f%[-_]*[-_]*[-_]*}"
010020001_S-FOR-Sort-SYEXC
$ echo...
2,389
Posted By RudiC
Try also shell parameter expansion echo...
Try also shell parameter expansion
echo ${f%[-_]${f#*[_-]*[-_]*[_-]*[_-]*[_-]*}}
010020001_S-FOR-Sort-SYEXC
2,389
Posted By RavinderSingh13
Hello gnnsprapa, Apologies, in hurry I...
Hello gnnsprapa,

Apologies, in hurry I missed it. Please try following and let me know if this helps you.

awk 'END{split(FILENAME, array,"_");print array[1] "_" array[2]}'...
3,462
Posted By Don Cragun
The question RudiC presented was not about your...
The question RudiC presented was not about your requirements, but about what operating system you're using (which you have yet to answer) and what shell you're using (which you have answered). He...
1,392
Posted By ashok.mp87
$ find sourcedir/ -type f -exec mv -v {} destdir...
$ find sourcedir/ -type f -exec mv -v {} destdir \; > move.log

This command find all the files(type -f) in sourcedir and move it to destdir.

sourcedir - Directory which contains all...
Showing results 1 to 7 of 7

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