Sponsored Content
Full Discussion: Create a new file
Top Forums Shell Programming and Scripting Create a new file Post 302893807 by RavinderSingh13 on Friday 21st of March 2014 06:54:44 AM
Old 03-21-2014
Hello,

Following may help for same.

Code:
awk '{if($3 ~ /\-.*[[:digit:]]{3}/) {match($3,/\-.*[[:digit:]]{3}/); $(NF+1)=substr($3,RSTART+1,RLENGTH-1); print $0} else {match($3,/\-.*[[:digit:]]{2}/); $(NF+1)=substr($3,RSTART+1,RLENGTH-1); print $0}}' file_name

Output will be as follows.

Code:
ID mir-430
MI MI0001527 dre-mir-430a-1 mir-430
MI MI0001528 dre-mir-430b-1 mir-430
MI MI0001529 dre-mir-430c-1 mir-430
ID MIR166
MI MI0000199 ath-MIR165a MIR165
MI MI0000200 ath-MIR165b MIR165
ID mir-30
MI MI0000088 hsa-mir-30a mir-30
MI MI0000144 mmu-mir-30a mir-30
MI MI0000145 mmu-mir-30b mir-30


Thanks,
R. Singh

Last edited by RavinderSingh13; 03-23-2014 at 11:32 PM.. Reason: changed output according to expectation
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read a file and search a value in another file create third file using AWK

Hi, I have two files with the format shown below. I need to read first field(value before comma) from file 1 and search for a record in file 2 that has the same value in the field "KEY=" and write the complete record of file 2 with corresponding field 2 of the first file in to result file. ... (11 Replies)
Discussion started by: King Kalyan
11 Replies

2. Shell Programming and Scripting

how to create file.txt and add current date in file content

Hey guy, how to make bash script to create foo.txt file and add current date into file content and that file always append. example: today the script run and add today date into content foo.txt and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
3 Replies

3. Shell Programming and Scripting

Newbie.. Find if a file exists and open, if not create the desired file..

Hey all, I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far.. #! bin/bash echo "Enter desired file" read "$file" if ... (5 Replies)
Discussion started by: Byrang
5 Replies

4. Shell Programming and Scripting

Create shell script to extract unique information from one file to a new file.

Hi to all, I got this content/pattern from file http.log.20110808.gz mail1 httpd: Account Notice: close igchung@abc.com 2011/8/7 7:37:36 0:00:03 0 0 1 mail1 httpd: Account Information: login sastria9@abc.com proxy sid=gFp4DLm5HnU mail1 httpd: Account Notice: close sastria9@abc.com... (16 Replies)
Discussion started by: Mr_47
16 Replies

5. Shell Programming and Scripting

How to create a log file that simply shows the name of a file and what directory it was moved to.

Newbie...Thank you for your help. I am creating my first script that simply generates subdirectories to organize video, music, and text files within those subdirectories from my current working directory. PROBLEM: I am trying to write a log file that contains, for each file, the original file... (0 Replies)
Discussion started by: BartleDoo
0 Replies

6. Shell Programming and Scripting

create txt file form data file and add some line on it

Hi Guys, I have file A.txt File A Data AK1521 AK2536 AK3164 I want create text file of all data above and write some data on each file. want Output on below folder /home/kka/out AK1521.txt Hi Welocme (3 Replies)
Discussion started by: asavaliya
3 Replies

7. Shell Programming and Scripting

How to compare 2 files and create a result file with unmatched lines from first file.?

HI, I have 2 text files. file1 and file2. file1.txt (There are no duplicates in this file) 1234 3232 4343 3435 6564 6767 1213 file2.txt 1234,wq,wewe,qwqw 1234,as,dfdf,dfdf 4343,asas,sdds,dsds 6767,asas,fdfd,fdffd I need to search each number in file1.txt in file2.txt's 1st... (6 Replies)
Discussion started by: Little
6 Replies

8. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

9. Shell Programming and Scripting

Create a text file and a pdf file from Linux command results.

Hello. The task : Using multiple commands like : gdisk -l $SOME_DISK >> $SOME_FILEI generate some text file. For readiness I must insert page break. When the program is finished I want to convert the final text file to a pdf file. When finished, I got two files : One text file and One pdf... (1 Reply)
Discussion started by: jcdole
1 Replies
sane-microtek(5)						File Formats Manual						  sane-microtek(5)

NAME
sane-microtek - SANE backend for Microtek scanners DESCRIPTION
The sane-microtek library implements a SANE (Scanner Access Now Easy) backend that provides access to the "second generation" Microtek scanners. At present, the following hardware is known to work with this backend: Microtek ScanMaker E2, E3, E6 Microtek ScanMaker II, IIG, IIHR, IISP, III Microtek ScanMaker 35t, 35t+, 45t Microtek ScanMaker 600GS, 600ZS (see bug notes) Agfa StudioScan Agfa StudioScan II, StudioScan IIsi Agfa Arcus II (but not the "Arcus") Agfa DuoScan (premliminary) Vobis "Highscreen Realscan" Microtek Color PageWiz (preliminary) Transparent Media Adapter Document AutoFeeder The driver supports line art, halftone, 8bpp gray, and 24bpp color scans at normal and "expanded" resolutions (i.e. 1200x1200 on an E6), fast scans for color previews, and downloadable gamma tables. The supported scanners are all SCSI scanners. However, some parallel port models may work (under Linux), if they use a parport->scsi chip, and if you can find a scsi->parport driver. This is known to be the case for the Color PageWiz. The driver does not support the newest Microtek scanners, such as the V330 and V660, which use a new and very different SCSI-II command set. For those, try the alternate microtek2 backend. Most non-SCSI scanners would use the new command set. Most scanners newer than the Scanmaker E6 would use the new command set. If you own a Microtek scanner other than the ones listed above, tell us what happens --- see the BUGS section at the end of this document. Although this manual page is generally updated with each release, up-to-date information on new releases and extraneous helpful hints are available from the backend homepage: http://www.mir.com/mtek/ DEVICE NAMES
This backend expects device names of the form: special Where special is the UNIX path-name for the special device that corresponds to the scanner. The special device name must be a generic SCSI device or a symlink to such a device. Under Linux, such a device name could be /dev/sga or /dev/sge, for example. CONFIGURATION
The contents of the microtek.conf file is a list of device names that correspond to Microtek scanners. Empty lines and lines starting with a hash mark (#) are ignored. A sample configuration file is shown below: /dev/scanner # this is a comment /dev/sge The configuration file may also contain the special tokens norealcal or noprecal. norealcal will disable the use of magic, undocumented scanner calibration commands which are known to work on the E6, but may not work with other models. noprecal will disable logic which tries to avoid scanner precalibration. This logic would only have been activated if the magic calibration code was turned off. FILES
/etc/sane.d/microtek.conf The backend configuration file (see also description of SANE_CONFIG_DIR below). /usr/lib/sane/libsane-microtek.a The static library implementing this backend. /usr/lib/sane/libsane-microtek.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_CONFIG_DIR This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura- tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explic- itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".", and "/etc/sane.d" being searched (in this order). SANE_DEBUG_MICROTEK If the library was compiled with debugging support enabled, this environment variable controls the debug level for this backend. A value of 128 requests maximally copious debug output; smaller levels reduce verbosity. SEE ALSO
sane(7), sane-scsi(5) AUTHOR
Matt Marjanovic BUGS
Known bugs/limitations are: Brightness and contrast broken. The 600GS is grayscale only, and will lock up if you select color. (Unfortunately, the 600GS and 600ZS are indistinguishable by software.) i.e. don't complain about these --- but if brightness and/or contrast do work for you, please tell me. If your scanner locks up, try setting the norealcal or noprecal option in the configuration file (first one, then both), and see if it helps. (If it does, report it.) Send lengthy bug reports and new scanner information to mtek-bugs@mir.com. All bug reports and new scanner inquiries should include an error log file. You can generate copious stderr output by setting the SANE_DEBUG_MICROTEK environment variable described above. For exam- ple: setenv SANE_DEBUG_MICROTEK 128 More general comments, suggestions, and inquiries about frontends or SANE should go to sane-devel@mostang.com, the SANE Developers mailing list. Have a look at http://www.mostang.com/sane/mail.html concerning subscription to sane-devel. February 8, 2000 sane-microtek(5)
All times are GMT -4. The time now is 09:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy