Sponsored Content
Full Discussion: [ask]rename file
Top Forums Shell Programming and Scripting [ask]rename file Post 302535157 by zvtral on Thursday 30th of June 2011 03:43:56 AM
Old 06-30-2011
@itkamaraj thx for replaying

solve with this because that file like
bca.20110201231.321.txt
asd.20110302311.313.txt

Code:
for i in `ls *.txt`
do
 temp=`echo $i | awk -F '.' '{sub(".",$2);print substr($2,0,9)}'`
 now=$(date '+%Y%m%d')
 
 cat "$i" >> "$temp"_"$now".TXT

done

ok guys my case this one solve i can doing like this
Code:
#!/bin/bash
FILE='/home/tux/tesitng/file/'
STAGING='/home/tux/tesitng/staging/'

for i in `find $STAGING -name "*.txt"`
do
 temp=`echo $i | awk -F '.' '{sub(".",$2);print substr($2,0,9)}'`
 now=$(date '+%Y%m%d')
 if [ "$temp" = "$now" ]
    then
     cat "$i" >> $FILE/"$temp".TXT
    else
     cat "$i" >> $FILE/"$temp"_"$now".TXT
 fi
done

thx for visiting Smilie



Last edited by zvtral; 06-30-2011 at 04:54 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with multiple file rename - change case of part of file name

Hi there, I hope someone can help me with this problem : I have a directory (/var/www/file/imgprofil) which contains about 10000 JPG files. They have a naming convention thus : prefix-date-key-suffix.jpg they all have the prefix p-20050608- then AAAA is a 4 letter code the suffix is... (7 Replies)
Discussion started by: steve7
7 Replies

2. Shell Programming and Scripting

Rename a file name

Hi, I am getting a file name from a remote server thru ftp and storing this filename in a variable. I am doing this in ftp mode. for ex: the filename is like emp_010208. This file name has to be changed to emp. Can you please let me know how we can do this while we are in ftp mode. thanks,... (0 Replies)
Discussion started by: Aswarth
0 Replies

3. UNIX for Dummies Questions & Answers

Rename file based on first 3 characters of data in file

I'm looking to determine if I can use a grep command to read file and rename the file based on the first 3 characters of the data in the file. An example is: Read FileA If the first 3 positions of the data in the file are "ITP", then rename the file as FileA_ITP, else if the first 3... (3 Replies)
Discussion started by: jchappel
3 Replies

4. Shell Programming and Scripting

A script that will move a file to a directory with the same name and then rename that file

Hello all. I am new to this forum (and somewhat new to UNIX / LINUX - I started using ubuntu 1 year ago).:b: I have the following problem that I have not been able to figure out how to take care of and I was wondering if anyone could help me out.:confused: I have all of my music stored in... (7 Replies)
Discussion started by: marcozd
7 Replies

5. UNIX for Dummies Questions & Answers

Rename a file

how to rename a file if I don't know file location ? Can we below command : $ find / | mv file1.txt I am not sure........can any1 help me out ? Thanks, Tushar Joshi:mad: (1 Reply)
Discussion started by: tusharjoshi
1 Replies

6. UNIX for Dummies Questions & Answers

look for specific values in a file and rename file with value found

Hi, i have a file with some data ..look for some specific value in the file and if found that value rename the file with the value found in the file.. ex.. File.txt 1236 43715825601ANDERSSON, 1236 437158256031963040120060901200609010000000 1236 43715825604123 MCCL AVE UPPER 1236 ... (11 Replies)
Discussion started by: dssyadav
11 Replies

7. Shell Programming and Scripting

rename file

Hi, I have files in the format thread_1_seq_1965.440.755943413 thread_1_seq_1966.577.755943443 thread_2_seq_2034.383.388388888 I want to rename this in the form of 1_1965.arc 1_1966.arc 2_2034.arc Discard everything except the th char and . The character position... (3 Replies)
Discussion started by: bang_dba
3 Replies

8. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

9. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. Shell Programming and Scripting

Bash to copy file 3 times and rename based on another file

In the below bash I am trying to copy the only text file (always only one) in /home/cmccabe/Desktop/list/QC/metrics.txt and rename each of the 3 text files according to /home/cmccabe/Desktop/test/list.txt using lines 3, 4 ,5. This format (that is list.txt) is always 5 lines. Thank you :). ... (12 Replies)
Discussion started by: cmccabe
12 Replies
COMBINE_TESSDATA(1)													       COMBINE_TESSDATA(1)

NAME
combine_tessdata - combine/extract/overwrite Tesseract data SYNOPSIS
combine_tessdata [OPTION] FILE... DESCRIPTION
combine_tessdata(1) is the main program to combine/extract/overwrite tessdata components in [lang].traineddata files. To combine all the individual tessdata components (unicharset, DAWGs, classifier templates, ambiguities, language configs) located at, say, /home/$USER/temp/eng.* run: combine_tessdata /home/$USER/temp/eng. The result will be a combined tessdata file /home/$USER/temp/eng.traineddata Specify option -e if you would like to extract individual components from a combined traineddata file. For example, to extract language config file and the unicharset from tessdata/eng.traineddata run: combine_tessdata -e tessdata/eng.traineddata /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharset The desired config file and unicharset will be written to /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharset Specify option -o to overwrite individual components of the given [lang].traineddata file. For example, to overwrite language config and unichar ambiguities files in tessdata/eng.traineddata use: combine_tessdata -o tessdata/eng.traineddata /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharambigs As a result, tessdata/eng.traineddata will contain the new language config and unichar ambigs, plus all the original DAWGs, classifier templates, etc. Note: the file names of the files to extract to and to overwrite from should have the appropriate file suffixes (extensions) indicating their tessdata component type (.unicharset for the unicharset, .unicharambigs for unichar ambigs, etc). See k*FileSuffix variable in ccutil/tessdatamanager.h. Specify option -u to unpack all the components to the specified path: combine_tessdata -u tessdata/eng.traineddata /home/$USER/temp/eng. This will create /home/$USER/temp/eng.* files with individual tessdata components from tessdata/eng.traineddata. OPTIONS
-e .traineddata FILE...: Extracts the specified components from the .traineddata file -o .traineddata FILE...: Overwrites the specified components of the .traineddata file with those provided on the comand line. -u .traineddata PATHPREFIX Unpacks the .traineddata using the provided prefix. CAVEATS
Prefix refers to the full file prefix, including period (.) COMPONENTS
The components in a Tesseract lang.traineddata file as of Tesseract 3.02 are briefly described below; For more information on many of these files, see http://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3 lang.config (Optional) Language-specific overrides to default config variables. lang.unicharset (Required) The list of symbols that Tesseract recognizes, with properties. See unicharset(5). lang.unicharambigs (Optional) This file contains information on pairs of recognized symbols which are often confused. For example, rn and m. lang.inttemp (Required) Character shape templates for each unichar. Produced by mftraining(1). lang.pffmtable (Required) The number of features expected for each unichar. Produced by mftraining(1) from .tr files. lang.normproto (Required) Character normalization prototypes generated by cntraining(1) from .tr files. lang.punc-dawg (Optional) A dawg made from punctuation patterns found around words. The "word" part is replaced by a single space. lang.word-dawg (Optional) A dawg made from dictionary words from the language. lang.number-dawg (Optional) A dawg made from tokens which originally contained digits. Each digit is replaced by a space character. lang.freq-dawg (Optional) A dawg made from the most frequent words which would have gone into word-dawg. lang.fixed-length-dawgs (Optional) Several dawgs of different fixed lengths -- useful for languages like Chinese. lang.cube-unicharset (Optional) A unicharset for cube, if cube was trained on a different set of symbols. lang.cube-word-dawg (Optional) A word dawg for cube's alternate unicharset. Not needed if Cube was trained with Tesseract's unicharset. lang.shapetable (Optional) When present, a shapetable is an extra layer between the character classifier and the word recognizer that allows the character classifier to return a collection of unichar ids and fonts instead of a single unichar-id and font. lang.bigram-dawg (Optional) A dawg of word bigrams where the words are separated by a space and each digit is replaced by a ?. lang.unambig-dawg (Optional) TODO: Describe. lang.params-training-model (Optional) TODO: Describe. HISTORY
combine_tessdata(1) first appeared in version 3.00 of Tesseract SEE ALSO
tesseract(1), wordlist2dawg(1), cntraining(1), mftraining(1), unicharset(5), unicharambigs(5) COPYING
Copyright (C) 2009, Google Inc. Licensed under the Apache License, Version 2.0 AUTHOR
The Tesseract OCR engine was written by Ray Smith and his research groups at Hewlett Packard (1985-1995) and Google (2006-present). 02/09/2012 COMBINE_TESSDATA(1)
All times are GMT -4. The time now is 08:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy