Sponsored Content
Top Forums Shell Programming and Scripting combine two perl lines into a single perl command Post 302325327 by jimmy_y on Sunday 14th of June 2009 03:19:37 PM
Old 06-14-2009
Lightbulb combine two perl lines into a single perl command

Hi Everyone,
i have a string 00:44:40

so:
$tmp=~ s/://gi;
$tmp=~s/([0-9]{2})([0-9]{2})([0-9]{2})/$1*3600+$2*60+$3/e;

the output is 2680.

Any way to combine this two lines into a single line?

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed or grep or perl combine two lines

how do i search for the phrase "expected" on line one and "received" on line two. (there is a newline in between the two) I would like to know if/how this can be done in perl and/or grep and/or sed (3 Replies)
Discussion started by: artjaniger
3 Replies

2. Shell Programming and Scripting

combining perl regex'es into a single command

Hi Gurus, I have a working solution for munging my data but just wondered if there was a way I could streamline it into a single command at all ? my $filesystem = "backup/server56/oracle/" $filesystem =~ s/\/+$// ; # remove the trailing slash(es) from the path specified... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

3. Shell Programming and Scripting

perl combine if

Hi Evereyone, %q = (); $q{"a"} = 0; $q{"b"} = 0; $q{"c"} = 0; if ($q{"a"} !=0 || $q{"b"} !=0 || $q{"c"} !=0) { print "non-zero" } if any simple way to do that? assume you have not only a, b, c inside %q, but a, b, c, d, e, ... ... Thanks (2 Replies)
Discussion started by: jimmy_y
2 Replies

4. Shell Programming and Scripting

Command to remove duplicate lines with perl,sed,awk

Input: hello hello hello hello monkey donkey hello hello drink dance drink Output should be: hello hello monkey donkey drink dance (9 Replies)
Discussion started by: cola
9 Replies

5. Shell Programming and Scripting

Combine multiple lines in single line

This is related to one of my previous post but now with a slight difference: I need the "Updated:" to be in one line as well as the "Information:" on one line as well. These are in multiple lines right now as seen below. These can have 2 or more lines that needs to be in one line. System name:... (8 Replies)
Discussion started by: The One
8 Replies

6. Shell Programming and Scripting

Replace single quote with two single quotes in perl

Hi I want to replace single quote with two single quotes in a perl string. If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Discussion started by: DushyantG
3 Replies

7. Programming

PERL:Combining multiple lines to single line

Hi All I need a small help for the below format in making a small script in Perl or Shell. I have a file in which a single line entries are broken into three line entries. Eg: I have a pen and notebook. All i want is to capture in a single line in a separate file. eg: I have a pen and... (4 Replies)
Discussion started by: Kalaiela
4 Replies

8. Shell Programming and Scripting

Combine multiple unique lines from event log text file into one line, use PERL or AWK?

I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice. I've got a text file full of hundreds of events in this format: Record Number : 1 Records in Seq : ... (3 Replies)
Discussion started by: Mayday22
3 Replies

9. Shell Programming and Scripting

Combine multiple lines into single line

Hi All , I have a file with below data # User@Host: xyz @ # Query_time: t1 Lock_time: t2 Rows_sent: n1 Rows_examined: n2 SET timestamp=1396852200; select count(1) from table; # Time: 140406 23:30:01 # User@Host: abc @ # Query_time: t1 Lock_time: t2 Rows_sent: n1 Rows_examined:... (6 Replies)
Discussion started by: rakesh_411
6 Replies

10. Shell Programming and Scripting

How to add line breaks to perl command with large text in single quotes?

Below code extracts multiple field values from XML into array and prints all in one line. perl -nle '@r=/(?: jndiName| authDataAlias| value| minConnections| maxConnections| connectionTimeout| name)="(+)/g and print join ",",$ENV{tIPnSCOPE},$ENV{pr ovider},$ENV{impClassName},@r' server.xml ... (4 Replies)
Discussion started by: kchinnam
4 Replies
GIT-MERGE-FILE(1)						    Git Manual							 GIT-MERGE-FILE(1)

NAME
git-merge-file - Run a three-way file merge SYNOPSIS
git merge-file [-L <current-name> [-L <base-name> [-L <other-name>]]] [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>] <current-file> <base-file> <other-file> DESCRIPTION
git merge-file incorporates all changes that lead from the <base-file> to <other-file> into <current-file>. The result ordinarily goes into <current-file>. git merge-file is useful for combining separate changes to an original. Suppose <base-file> is the original, and both <current-file> and <other-file> are modifications of <base-file>, then git merge-file combines both changes. A conflict occurs if both <current-file> and <other-file> have changes in a common segment of lines. If a conflict is found, git merge-file normally outputs a warning and brackets the conflict with lines containing <<<<<<< and >>>>>>> markers. A typical conflict will look like this: <<<<<<< A lines in file A ======= lines in file B >>>>>>> B If there are conflicts, the user should edit the result and delete one of the alternatives. When --ours, --theirs, or --union option is in effect, however, these conflicts are resolved favouring lines from <current-file>, lines from <other-file>, or lines from both respectively. The length of the conflict markers can be given with the --marker-size option. The exit value of this program is negative on error, and the number of conflicts otherwise. If the merge was clean, the exit value is 0. git merge-file is designed to be a minimal clone of RCS merge; that is, it implements all of RCS merge's functionality which is needed by git(1). OPTIONS
-L <label> This option may be given up to three times, and specifies labels to be used in place of the corresponding file names in conflict reports. That is, git merge-file -L x -L y -L z a b c generates output that looks like it came from files x, y and z instead of from files a, b and c. -p Send results to standard output instead of overwriting <current-file>. -q Quiet; do not warn about conflicts. --ours, --theirs, --union Instead of leaving conflicts in the file, resolve conflicts favouring our (or their or both) side of the lines. EXAMPLES
git merge-file README.my README README.upstream combines the changes of README.my and README.upstream since README, tries to merge them and writes the result into README.my. git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345 merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels a and c instead of tmp/a123 and tmp/c345. GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-MERGE-FILE(1)
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy