Sponsored Content
Top Forums UNIX for Advanced & Expert Users Match the string and copy records to another location Post 302277420 by radoulov on Friday 16th of January 2009 08:55:53 AM
Old 01-16-2009
I though this was the desired output,
am I missing something?

Code:
zsh-4.3.9[t]% awk '
quote> END { if (r ~ v) print r }
quote> /^\*\*\*/ { 
quote>   if (r ~ v) print r 
quote>   f = 1; r = "" 
quote>   }
quote> f { r = r ? r RS $0 : $0 }
quote> ' v='\\** PBX TYPE:ID6' test1.txt
****** PBX TYPE:ID6    PBX-id: L14      polled on 011409 133905           00 >>>>>>
L14,2009-01-14 13:36:00.000,64,38772, ,18905238433,E,38772, , ,052,046,N,00, ,2009-01-14 13:36:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486634
L13,2009-01-14 13:37:00.000,0, , ,1448845,E, ,052,016, , ,IN,00, ,2009-01-14 13:37:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486636
L21,2009-01-14 13:36:00.000,60, , ,38883,E, ,000,003,052,017,$1,00, ,2009-01-14 13:36:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486638
L12,2009-01-14 13:37:00.000,20, , ,38300,E, ,052,018, , ,IN,00, ,2009-01-14 13:37:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486640
L28,2009-01-14 13:32:00.000,302,38843, ,1890017722010,E,38843, , ,001,156,N,00, ,2009-01-14 13:32:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486642
L14,2009-01-14 13:34:00.000,168, , ,38945,E, ,000,007, , ,IN,00, ,2009-01-14 13:34:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486644
L16,2009-01-14 13:35:00.000,108,1448805, ,1890018498124,E,1448805, , ,001,138,N,00, ,2009-01-14 13:35:00.000, , ,0, ,0,0,0,0,0,0,0,0,0,0,0,14486646

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

2. UNIX for Dummies Questions & Answers

Copy directory from one location to other

Hi All, I am newbie for Unix. I want to copy a directory from one location to other. Can any one help me by providing the command to do following task. thanks in advance, Rakesh (2 Replies)
Discussion started by: rakeshvthu
2 Replies

3. Shell Programming and Scripting

Put one string from one location to another location in a file

Hi Everyone, I have 1.txt here a b c' funny"yes"; d e The finally output is: here a b c d e' funny"yes"; (1 Reply)
Discussion started by: jimmy_y
1 Replies

4. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

5. Shell Programming and Scripting

How to copy a file from one location to another location?

I have file file1.txt in location 'loc1'. Now i want a copy of this file in location 'loc2' with a new file called test.txt. Please help me how to do this in shell script. (1 Reply)
Discussion started by: vel4ever
1 Replies

6. Shell Programming and Scripting

Deleting duplicate records from file 1 if records from file 2 match

I have 2 files "File 1" is delimited by ";" and "File 2" is delimited by "|". File 1 below (3 record shown): Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies

7. Shell Programming and Scripting

How to copy files from one location to another based on a priority?

Hi Gurus, I am a newbie to shell scripting and I am facing a problem right now.I have to automate the copy of files based on a priority.The scenario is as below: 1) There will be files from Mon-Fri with Mon file being named as abc_def_01_YYYYMMDD and Tue file being abc_def_02_YYYYMMDD and so... (4 Replies)
Discussion started by: vikramgk9
4 Replies

8. Shell Programming and Scripting

Copy files from one location to another

I have below files in one location /test/files and also for each dates there are similar files A20130924.0000-0005_file1 A20130924.0000-0005_file2 A20130924.0005-0010_file1 A20130924.0005-0010_file2 . . . A20130924.2355-0000_file1 A20130924.2355-0000_file2 If i execute the script like... (4 Replies)
Discussion started by: Saidul
4 Replies

9. Shell Programming and Scripting

How to copy files from one location to another using xargs??

Hello Experts, I need to copy files from one location to another using xargs. Tried something like this (In Ubuntu & Solaris ). mkdir -p 1234; find /home/emd/Desktop/n007/M007/ -type f -name "A2014*" | xargs -0 cp -r {} /home/emd/Desktop/1234 But every time i run this, a weird error... (6 Replies)
Discussion started by: Saidul
6 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
Temporary(4)						     Kernel Interfaces Manual						      Temporary(4)

NAME
Temporary - Stores data files during transfers to remote systems SYNOPSIS
/usr/spool/uucp/SystemName/TM.xxPID.000 DESCRIPTION
The uucp Temporary (TM.*) files store data files during transfers to remote systems. After a Data (D.*) file is transferred to a remote system by the uucico daemon, the uucp program places it in a subdirectory of the uucp spooling directory named /usr/spool/uucp/SystemName, where the SystemName directory is named for the computer that is transmitting the file. The uucp program creates a temporary data file to hold the original data file. The full pathname of the temporary data file is in the following format: /usr/spool/uucp/SystemName/TM.xxPID.000 where the SystemName directory is named for the computer that is sending the file, and TM.xxPID.000 is the name of the file; for example, TM.00451.000. The PID variable is the process ID of the job. FILES
Describes accessible remote systems Contains uucp command, data, and execute files Contain data to be transferred. Contain files that uucp has transferred RELATED INFORMATION
Daemons: uucico(8) Commands: uucp(1), uudemon.cleanu(4), uupick(1), uuto(1), uux(1) delim off Temporary(4)
All times are GMT -4. The time now is 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy