Sponsored Content
Top Forums Shell Programming and Scripting help needed .. Unable to write the data to new file after matching the pattern Post 302272973 by Christoph Spohr on Friday 2nd of January 2009 05:23:23 AM
Old 01-02-2009
command:
Code:
grep -n "AB[0-9]\{1,2\} [0-9]\{1,2\}[A-Z]\{1,2\}" file

output:
Code:
7:102628,AB53 8AA,21
8:102628,AB53 8AB,21
9:102628,AB53 8AD,21
10:102628,AB53 8AE,21
11:102628,AB53 8AG,21
19:102636,AB54 7A,21
20:102636,AB54 7B,21
21:102636,AB54 7D,21
22:102636,AB54 7E,21

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern matching for file

Hi All, I'm new to perl, My requirement is to check if particular file exists. e.g. filename.txt, filename1.txt, filename2.txt etc I tried the below code:- my $var1 = "filename.txt" if ( -e ($var1 = ~ /file\w/)) { print "File found \n"; } else { print "File not found \n"; } ... (0 Replies)
Discussion started by: doitnow
0 Replies

2. Programming

File Pattern Matching C++

Hi, I have large files with fixed length fields or fields seperated by delimeter. I would like to do validation on some or all fields to check for numeric or date or characters etc.. I would like to write this in C++. Please let me know if any one have any ideas on this. Thanks for all... (2 Replies)
Discussion started by: rameshmelam
2 Replies

3. Shell Programming and Scripting

Removing data with pattern matching

I have the following: HH:MM:SS I want to use either % or # sign to remove :SS can somebody please provide me an example. I know how to do this in awk, but awk is too much overhead for something this simple since I will be doing this in a loop a lot of times. Thanks in advance to all... (2 Replies)
Discussion started by: BeefStu
2 Replies

4. UNIX for Dummies Questions & Answers

Unable to write to a file within a loop

Hi All, Following is the program that i have written in cygwin. The redirection of the unfound $param1 to error.txt file doesnt work.Can any one help? #!/usr/bin/sh fname=$1 sed 's/ //g' "$fname" > fname1 while read i do echo $i > file1 #param1 is script name ... (1 Reply)
Discussion started by: janardhanamk
1 Replies

5. Shell Programming and Scripting

Assistance needed for pattern matching

Hi, Below are input files:- File1:- 1: ### CREATE TABLE ## 2: SOMETHING ELSE 1 3: ### CREATE TABLE ## 4: ### CREATE <spaces> 5: TABLE ### 6:SOMETHING ELSE 2 7: ## CREATE 8: <spaces> TABLE ### 9: SOMETHING ELSE 3 File2:- Similar Format... Desired 1 Output File:- (3 Replies)
Discussion started by: kishal
3 Replies

6. Shell Programming and Scripting

Help with matching pattern inside a file

I have a huge file that has roughly 30304 lines. I need to extract specific info from that file. For example, Box 1 > *aaaaaaaajjjj* > hbbvjvj > jdnnfddllll > *dgdfhfekwjh* Box 2 > *aaaaaaa'aj'jjj* > dse hkjuejef bfdw > dyeee > dsewq > *dgdfhfekwjh* >feweiuei Box 3 > *aaaa"aaaaj"jjj* >... (25 Replies)
Discussion started by: Ernst
25 Replies

7. Shell Programming and Scripting

Script to read file and extract data by matching pattern

Hello, I have a file ( say file1) which has lines like below. xxxx:xxxx,yyyy,1234,efgh zzzz:zzzz,kkkk,pppp,1234,xxxx,uuuu,oooo dddd:dddd here the word before ":" ( ie: xxxx) is the file name and the string after : are also file names, but each file name separated by "," In case of... (20 Replies)
Discussion started by: pradeepmacha
20 Replies

8. Shell Programming and Scripting

Word matching and write other data

Hi all, I have 7 words CAD CD HT RA T1D T2D BD Now I have 1 file which contain data in large number of rows and columns from 2 nd column onwards it contain any of these 7 words or may be more than one words among above 7 words: these 7 names are present in starting from 2nd ... (7 Replies)
Discussion started by: manigrover
7 Replies

9. Shell Programming and Scripting

Big pattern file matching within another pattern file in awk or shell

Hi I need to do a patten match between files . I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time. Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies

10. Shell Programming and Scripting

IN Between Data after matching the Pattern

HI , I WANT TO RETRIVE IN BETWEEN DATA FROM PARENTHESIS AND I AM GETTING ERRORS WHILE RUN THE AWK.I HAVE 2 FILES AND WANT TO PROCESS 1ST FILE PATTERN TO 2ND FILE AND WRITES INTO OUTPUT FILE.THIS TIME I AM PUTTING WHERE EXACTLY I AM GETTING ERRORS.SO PLEASE HELP. PATTERN_FILE.TXT --------------... (1 Reply)
Discussion started by: andrew_11
1 Replies
MTOOLS(1)						      General Commands Manual							 MTOOLS(1)

NAME
Mtools - a collection of tools for manipulating MSDOS files SYNOPSIS
mattrib - change MSDOS file attribute flags mcd - change MSDOS directory mcopy - copy MSDOS files to/from Unix mdel - delete an MSDOS file mdir - display an MSDOS directory mformat - add an MSDOS filesystem to a low-level formatted diskette mlabel - make an MSDOS volume label mmd - make an MSDOS subdirectory mrd - remove an MSDOS subdirectory mread - low level read (copy) an MSDOS file to Unix mren - rename an existing MSDOS file mtype - display contents of an MSDOS file mwrite - low level write (copy) a Unix file to MSDOS DESCRIPTION
Mtools is a public domain collection of programs to allow Unix systems to read, write, and manipulate files on an MSDOS filesystem (typi- cally a diskette). Each program attempts to emulate the MSDOS equivalent command as closely as practical. MSDOS filenames are optionally composed of a drive letter followed by a colon, a subdirectory, and a filename. Subdirectory names can use either the '/' or '' separator. The use of the '' separator or wildcards will require the names to be enclosed in quotes to protect them from the shell. The regular expression "pattern matching" routines follow the Unix-style rules. For example, '*' matches all MSDOS files in lieu of '*.*'. The archive, hidden, read-only and system attribute bits are ignored during pattern matching. All options use the '-' (minus) flag, not '/' as you'd expect in MSDOS. The mcd command is used to establish the device and the current working directory (relative to the MSDOS filesystem), otherwise the default is assumed to be A:/. SEE ALSO
mattrib(1), mcd(1), mdel(1), mformat(1), mrd(1), mren(1), mtype(1), mcopy(1), mdir(1), mlabel(1), mmd(1), mread(1), mwrite(1) BUGS
An unfortunate side effect of not guessing the proper device (when multiple disk capacities are supported) is an occasional error message from the device driver. These can be safely ignored. local MTOOLS(1)
All times are GMT -4. The time now is 03:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy