Sponsored Content
Top Forums Shell Programming and Scripting Reading files of different type and same basename Post 302785039 by Akshay Hegde on Sunday 24th of March 2013 12:03:35 PM
Old 03-24-2013
Sir there are only 2 ways left to me as there are many comparison inside script

one is use txt and asc as separate variable

2nd one is merge base name matching file and write id number to file

assume file_1.txt looks like this

Code:
15-12-1996   21-2-2024 12 34,000 888 976  1
15-12-1994   21-2-2026 12 35,000 885 977  2
15-12-1993   21-2-2025 12 37,000 887 976  3
15-12-1995   21-2-2029 12 39,000 878 976  4

and file_1.asc looks like this
Code:
15-12-1996   21-2-2024 12 34,000 888 976  1
15-12-1995   21-2-2029 12 39,000 878 976  4
15-12-1994   21-2-2026 12 35,000 885 977  2
15-12-1993   21-2-2025 12 37,000 887 976  3
15-12-1994   21-2-2026 12 35,000 885 977  2
15-12-1993   21-2-2025 12 37,000 887 976  3

then merged file should look like this
Code:
15-12-1996   21-2-2024 12 34,000 888 976  1 id1
15-12-1994   21-2-2026 12 35,000 885 977  2 id1
15-12-1993   21-2-2025 12 37,000 887 976  3 id1
15-12-1995   21-2-2029 12 39,000 878 976  4 id1
15-12-1996   21-2-2024 12 34,000 888 976  1 id2
15-12-1995   21-2-2029 12 39,000 878 976  4 id2
15-12-1994   21-2-2026 12 35,000 885 977  2 id2
15-12-1993   21-2-2025 12 37,000 887 976  3 id2
15-12-1994   21-2-2026 12 35,000 885 977  2 id2
15-12-1993   21-2-2025 12 37,000 887 976  3 id2

out of 2 any one solution can complete my task
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Type v for generated files

Hi All, I was checking some of the files and I got the following entries:- =============== v, 664, serv, serv, version.txt, exe L, 775, serv, serv, start.sh, eventserv ================ Could someone please tell me what does the type"v" and "L" represent to. I have not... (2 Replies)
Discussion started by: shubhranshu
2 Replies

2. Shell Programming and Scripting

[php] ftp get all files from a certain file type

Hi all, I googled for this kind of function but didn't find anything. I have an FTP connection with a server, went to the dir. In this dir there are several TXT files. I would like to have function that downloads all this files, based on their .txt extension. In bash, for example, simply:... (10 Replies)
Discussion started by: laurens
10 Replies

3. UNIX for Advanced & Expert Users

Deleting older files of a particular type

hi This should be easy but i'm obviously missing something obvious. :) I'm looking to delete files from yesterday and older of extension .txt and there a range of subfolders with these files in them. The command runs but doesn't delete anything. SUSE 10. find /testfolder -maxdepth 2 -type f... (6 Replies)
Discussion started by: cmap
6 Replies

4. UNIX for Advanced & Expert Users

find -type d returning files as well as directories

Can anyone see why the following command returns all files and not just the directories as specified? find . -type d -exec ls -F {} \; Also tried find . -type d -name "*" -exec ls -F {} \; find . -type d -name "*" -exec ls -F '{}' \; -print Always returns all files :-\ OS is... (2 Replies)
Discussion started by: tuns99
2 Replies

5. Shell Programming and Scripting

Delete files of the same type if there are more than 3

hi, I would like to delete files in a folder starting with letters ab and fe and so on. It should only delete if there are more than 3 files of that type in that folder. Please suggest me how to write a script. i am new to this scripting. (4 Replies)
Discussion started by: Sneddy
4 Replies

6. UNIX for Dummies Questions & Answers

Search in one type of files and replace

I am not sure how to search and replace the word in the few specific files. I need to search and replace word in only the name containing pepsi in the filename. (12 Replies)
Discussion started by: ramkumar15
12 Replies

7. Shell Programming and Scripting

Errors trying to use all files of a type

I am trying to create a code that will use all the bam files stored on a separate drive (/media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215), run them in a program that I have changed the directory to, and the output gets re-directed to (/home/cmccabe/Desktop/NGS/pool_I_090215). I have tried the... (11 Replies)
Discussion started by: cmccabe
11 Replies

8. Shell Programming and Scripting

Latest list of files of each type

find /tmp/testlog/kSR*"_"2018* -type f -printf '%T@ %p\n' | sort -n | tail -3 | cut -f2- -d" " /tmp/testlog/log/KSR04_2018-07-05.log /tmp/testlog/log/KSR04_2018-07-06.log /tmp/testlog/log/KSR01_2018-07-06.log But, I would see the following output(latest files for each KSR tuype) ... (3 Replies)
Discussion started by: jhonnyrip
3 Replies
CFDISK(8)							 GNU cfdisk Manual							 CFDISK(8)

NAME
GNU cfdisk - a curses-based partition table manipulation program SYNOPSIS
cfdisk [options] [device] DESCRIPTION
cfdisk is a disk partition manipulation program, which allows you to create, destroy, resize, move and copy partitions on a hard drive using a simple menu-driven interface. It is useful for organising the disk space on a new drive, reorganising an old drive, creating space for new operating systems, and copying data to new hard disks. For a list of the supported partition types, see the --list-partition-types option below. OPTIONS
-h, --help displays a help message. -v, --version displays the program's version. -a, --arrow-cursor use an arrow cursor, instead of reverse video highlighting, in case your terminal doesn't support it. -z, --new-table create a new partition table on the disk. This is useful if you want to change the partition table type or want to repartition you entire drive. Note that this does not delete the old table on the disk until you commit the changes. -u, --units=UNIT sets the default display units to UNIT. A list of possible units is given below. -t, --list-partition-types displays a list of supported partition types and features. UNITS
You can choose in what unit cfdisk should display quantities like partition sizes. You can choose from sectors, percents, bytes, kilobytes, etc. Note that one kilobyte is equal to 1,000 bytes, as this is consistent with the SI prefixes and is used by hard disk manufacturers. If you prefer to see the sizes in units with binary prefixes, you should instead select one kilo binary byte (kibibyte), which is equal to 1,024 bytes. Whatever display unit you have chosen, you can always enter the quantities in the unit of your choice, for example 1000000B or 1000kB. compact display each size in the most suitable unit from B, kB, MB, GB and TB. B one byte kB one kilobyte (1,000 bytes) MB one megabyte (1,000,000 bytes) GB one gigabyte (1,000,000,000 bytes) TB one terabyte (1,000,000,000,000 bytes) KiB one kilo binary byte (1,024 bytes) MiB one mega binary byte (1,048,576 bytes) GiB one giga binary byte (1,073,741,824 bytes) TiB one tera binary byte (1,099,511,627,776 bytes) s one sector. It depends on the sector size of the disk. You can use it if you want to see or choose the exact size in sectors. % one percent from the size of the disk cyl one cylinder. It depends on the cylinder size. chs use CHS display units. BUGS
There are no known bugs. We are in early stages for development, so be careful. SEE ALSO
fdisk(8), mkfs(8), parted(8) The cfdisk program is fully documented in the info(1) format GNU cfdisk User Manual manual. fdisk 16 June, 2006 CFDISK(8)
All times are GMT -4. The time now is 07:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy