Editing all files inside folders and updating pos 88-94 with continuous numbering.
Here is expected output:-
For each file with following file name pattern we need to look at position 1 inside first file matching our search criteria if first letter of the line is 5 then position 88-94 will be 0000001 then look for line immediately after 5 which starts with i.e. position 1 = 8 then position 88-94 will be 0000001 for that line starting with 8. Now again look first line start with 5, if matches then set position 88-94 will be 0000002. Now again look for line starting with 8 and set position 88-94 will be 0000002. Process this untill end of First file. Now assume last occurrence of line starting with 8 have position 88-94 = 0000010 then Look for occurrence of 5 in position 1 inside Second file If found then set position 88-94 will be 0000011, Also find line staring with 8 immediately and set position 88-94 will be 0000011.Continue numbering this until we are done with file matching our file search criteria. Expected Output:- File 1 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss123.data
File 2 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss145.data
File 3 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss167.data
File 4 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss189.data
Here is the Code which find the files matching criteria:-
Last edited by lancesunny; 12-11-2012 at 05:56 PM..
Here is expected output:-
For each file with following file name pattern we need to look at position 1 inside first file matching our search criteria if first letter of the line is 5 then position 88-94 will be 0000001 then look for line immediately after 5 which starts with i.e. position 1 = 8 then position 88-94 will be 0000001 for that line starting with 8. Now again look first line start with 5, if matches then set position 88-94 will be 0000002. Now again look for line starting with 8 and set position 88-94 will be 0000002. Process this untill end of First file. Now assume last occurrence of line starting with 8 have position 88-94 = 0000010 then Look for occurrence of 5 in position 1 inside Second file If found then set position 88-94 will be 0000011, Also find line staring with 8 immediately and set position 88-94 will be 0000011.Continue numbering this until we are done with file matching our file search criteria.
File 1 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss123.data
File 2 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss145.data
File 3 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss167.data
File 4 name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss189.data
Here is the Code which find the files matching criteria:-
Last edited by lancesunny; 12-10-2012 at 11:35 PM..
Your input and output data is missing a whole lot of columns. It also contains two leading tabs which may or may not actually be part of your data -- quite unclear. If I make a program that works with your 'data', it is guaranteed to not work for you.
This is probably why you've gotten so few replies.
Is this more like what your data actually looks like? (exclude the first line)
Also, do you realize that your file-finding code will not find these files in any particular order? It will be arbitrarily determined by which is found first in the filesystem, not by their filenames.
Last edited by Corona688; 12-11-2012 at 01:14 PM..
I am processing input files which consist of 94 characters per line.
Your representation of input file data is correct. Every file consists of 94 characters per line.File name = ABCDEFG1234567_mm-dd-yy_hh_mm_ss123.data.
I agree my file finding code will select file based on arbitrarily determined by which is found first in the file system. I think that code can be modified to find file based on date and early HH:MM:SS time present in file.
Hi,
I need to uncompress sevral tar.gz files that are located insides sevral folders using a shell script.
Folder tree looks like this :
/folder/001
/folder/002
/folder/003 Inside each folder dossier (001,002,003) we can find 1 or several tar.gz files.
I've scripted something... (9 Replies)
Hi,
So i know we use cp -r as a basic to copy folders/files.
I would like this BUT i would like to show the output of the files being copied.
With the amazing knowledge i have i have gone as far as this:
1) find source/* -exec cp -r {} target/ \;
2) for ObjectToBeCopied in `find... (6 Replies)
hi,
i have a requirement to delete all the files from all the directories except some specific directories like archive and log.
for example:
there are following directories such as
A B C D Archive E Log F
which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
I need to process 4 files having name pattern as followis:-
1) Each file starts with = ABCJmdmfbsjop letters + 7 Digit Number _mm-dd-yyyy-hh-mm-ss-3 Digit Number.data
where ABCJmdmfbsjop :- is alphabet. Each file starts with this ABCJmdmfbsjop alphabet.
7 Digit Number :- Numeric 7 digits.
__:-... (1 Reply)
Script for if characters from positions 7-15 are matching with characters from position 211-219 then replace all char from 211-219 with 9 space.
Total length of record is 420. Here is the specification of the data in file.
Position Field Data Type... (5 Replies)
Hi guys,
I'm new to the forums and putting my foot in the door with SED and AWK. I was wondering if someone could help me as I think I'm making this harder than it needs to be...
I have a list of folders named as urls, inside these are log files and possibly a 'status' file. I'm trying to get... (6 Replies)
I have an input file with contents like :
1LMXTJJD0W28TX2
1LS1XJGDEVWAC5T
1LK81JVDE2HRNDG
1LMXTJJD0W28TX2
1LS1XJGDEVWAC5T
1LK81JVDE2HRNDG
1LMXTJJD0W28TX2
I need to read each field from the file
pass it to a query:
select count(*) from usage_error where usage_id='$field... (17 Replies)
Hello again,
A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x.
I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
I have a huge collection of HTML files. They have their own file names with htmlextension. I want to rename each of these files with continuous numbers starting from 1.html till the last count of files. Simply it means that if there are three files like this
abc.html
cdfhg.html
rmbd.htmlthen... (1 Reply)
hey guys,
I'm trying to call and modify multiple files inside the for loop, i can't get it to work...
------------------------
AFILE=/dir/a_file.txt
BFILE=/dir/b_file.txt
CFILE=/dir/c_file.txt
ADESTFILE=/dir/a_dest_file.txt
BDESTFILE=/dir/b_dest_file.txt... (6 Replies)