Sponsored Content
Top Forums Shell Programming and Scripting need shell script to read particular records from a file Post 302317764 by durden_tyler on Wednesday 20th of May 2009 01:27:38 AM
Old 05-20-2009
And then some more:

Code:
$
$ perl -ne 'split/[: ]/; /^DATETIME:/ && print $_[3],"\n"' input.txt
TESTDAY.0428.20090424174530.01.OP
TESTDAY.0428.20090424174540.01.OP
TESTMON.0428.20090424174530.01.OP
TESTMON.0428.20090424174540.01.OP
$
$
$ grep ^DATETIME: input.txt | cut -d: -f3 | cut -d' ' -f1
TESTDAY.0428.20090424174530.01.OP
TESTDAY.0428.20090424174540.01.OP
TESTMON.0428.20090424174530.01.OP
TESTMON.0428.20090424174540.01.OP
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read records from a file

Hi all, I have a requirement where I need to read records one by one from a file. I have tried this below code: while read mLine do echo 'Line = '${mLine} done < input_file --- But the problem here is im getting the records with removed spaces. --Supposer if the record is like... (3 Replies)
Discussion started by: srilaxmi
3 Replies

2. Shell Programming and Scripting

unix shell script which inserts some records into a file located in remote servers...

All, I need to write an unix shell script which inserts some records into a file located in remote servers. * Get the input from the user and insert according the first row. It should be in ascending order. 123451,XA,ABA 123452,XB,ABB 123453,XC,ABC 123455,XE,ABE 123456,XF,ABF 123458,XG,ABG... (2 Replies)
Discussion started by: techychap
2 Replies

3. UNIX for Dummies Questions & Answers

update records in a file using shell script...

Hi, I have a file with 6 columns. First 3 columns together make unique record. I have a variable ($v) which hold a value that is obtained by a caliculaion. I have to replace value in 5th columnn with the value of the variable ($v). The value $v is caliculated from col4 and col6 values. ... (2 Replies)
Discussion started by: new_learner
2 Replies

4. Shell Programming and Scripting

how to read dbf file in shell script and to convert dbf file usinf shell script

Hi all, I am new to shell scripting. I have dbf file and I need to convert it into csv file. OR, can i read the fields from a .dbf file and OR seprate the records in dbf file and put into .csv or txt. Actually in the .dbf files I am getting , the numbers of fields may vary in very record and... (6 Replies)
Discussion started by: gauara
6 Replies

5. Shell Programming and Scripting

How to read each 2 records from a file

Hi, I have 10000 records in my test.dat file All records are under the following format a,12,45,bn,c a,16,46,bn1,c a,18,47,bn2,c a,12,47,bn3,c a,11,49,bn4,c I have to read each 2 records and assign it into a temp file .Can anybody help me in this? Thanks (3 Replies)
Discussion started by: kavithakuttyk
3 Replies

6. Shell Programming and Scripting

How to read records in a file and sort it?

I have a file which has number of pipe delimited records. I am able to read the records....but I want to sort it after reading. i=0 while IFS="|" read -r usrId dataOwn expire email group secProf startDt endDt smhRole RoleCat DataProf SysRole MesgRole SearchProf do print $usrId $dataOwn... (4 Replies)
Discussion started by: harish468
4 Replies

7. Shell Programming and Scripting

How to read a particular records from a file?

Hi All Can anybody let me know the code to read a particular record from a file For e.g. File Name: File.txt File content: Script_path=/abc/def/script/ File_path=/xyz/data/ Business Date=19990905 SERVER_NAME=Server DATABASE_NAME=Database Login=NewUser Password=NewPassword ... (3 Replies)
Discussion started by: Siddhartha9833
3 Replies

8. Shell Programming and Scripting

How to read a file through shell script?

hi all, i have to read a file using shell script for example my csv file is like this Tid Inputfille Inputfilepath 1 ABC_20141218.idr /export/home/him60t1/input 2 ABC_20141219.idr /export/home/him60t1/input1 what i have to do is if on my command line i... (1 Reply)
Discussion started by: ramsavi
1 Replies

9. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

10. Shell Programming and Scripting

Shell script to filter records in a zip file that contains matching columns from another file

Not sure if this is the correct forum for this question. I have two files. file1.zip, file2 Input: file1.zip col1, col2 , col3 a , b , 0:0:0:0:0:c436:9346:d40b x, y, 0:0:0:0:0:880:39f9:c9a7 m, n , 0:0:0:0:0:80c7:9161:fe00 file2.txt col1 c4:36:93:46:d4:0b... (1 Reply)
Discussion started by: anil.v
1 Replies
DATETIME.GETTIMEZONE(3) 						 1						   DATETIME.GETTIMEZONE(3)

DateTime::getTimezone - Return time zone relative to given DateTime

       Object oriented style

SYNOPSIS
public DateTimeZone DateTime::getTimezone (void ) DESCRIPTION
DateTimeZone DateTimeImmutable::getTimezone (void ) DateTimeZone DateTimeInterface::getTimezone (void ) Procedural style DateTimeZone date_timezone_get (DateTimeInterface $object) Return time zone relative to given DateTime. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3) RETURN VALUES
Returns a DateTimeZone object on success or FALSE on failure. EXAMPLES
Example #1 DateTime.getTimezone(3) example Object oriented style <?php $date = new DateTime(null, new DateTimeZone('Europe/London')); $tz = $date->getTimezone(); echo $tz->getName(); ?> Procedural style <?php $date = date_create(null, timezone_open('Europe/London')); $tz = date_timezone_get($date); echo timezone_name_get($tz); ?> The above examples will output: Europe/London SEE ALSO
DateTime.setTimezone(3). PHP Documentation Group DATETIME.GETTIMEZONE(3)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy