Sponsored Content
Top Forums Shell Programming and Scripting Oneliner ---split string to character by piping shell output to perl Post 302752609 by radoulov on Monday 7th of January 2013 09:17:26 AM
Old 01-07-2013
Code:
echo 'The quick brown fox jumps over the lazy dog' | 
  perl -le 'print join "$/", grep /\S/ && !$_{"\L$_"}++, split //, <>
    '

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Piping and assigning output to a variable in Perl

Hi All, I am trying to convert the below Csh code into Perl. But i have the following error. Can any expert help ? Error: ls: *tac: No such file or directory Csh set $ST_file = `ls -rt *$testid*st*|tail -1`; Perl my $ST_file = `ls -rt *$testid*st*|tail -1`; (10 Replies)
Discussion started by: Raynon
10 Replies

2. Shell Programming and Scripting

Perl use split and remove specific character

i want to split the input by a space and remove specific characters like full stop, comma...... etc. and then save each word in an array. i got something below, but it didn't work. can anyone please help me? Thank you #!/usr/bin/perl -w while (<>) { $line = <>; @word = split(' ',... (6 Replies)
Discussion started by: mingming88
6 Replies

3. Shell Programming and Scripting

Unix Perl split special character $

All I'm trying to split a string at the $ into arrays @data:=<dataFile> a $3.33 b $4.44 dfg $0.56 The split command I have been playing with is: split(/\$/, @data) which results with a .33 b .44 dfg .56 any help with this is appreciated /r Rick (9 Replies)
Discussion started by: schultz2146
9 Replies

4. Shell Programming and Scripting

how to get split output of a file, using perl script

Hi, I have file: data.log.1 ### s1 main.build.3495 main.build.199 main.build.3408 ###s2 main.build.3495 main.build.3408 main.build.199 I want to read this file and store in two arrays in Perl. I have following command, which is working fine on command prompt. perl -n -e... (1 Reply)
Discussion started by: ashvini
1 Replies

5. Shell Programming and Scripting

perl oneliner not works .pl script

I am trying to take first 3 columns in a file which matches the word "abc", but i am getting the below error, <error> Global symbol "@F" requires explicit package name at ./new.pl </error> whereas when i give the below,grep abc /home/test/file.txt|perl -lane 'print \"$F $F $F\" in unix prompt... (4 Replies)
Discussion started by: anspks
4 Replies

6. Shell Programming and Scripting

perl oneliner to cut the file

Hi I have a file say text.txt and has data as below. text.txt ------- /abc/def/tom/hanks /abc/def/al/pacino /def/dgg/matt/damon Now I have to cut the field 3 and field 4 treating / as delimiter and save in the same file. Below is the how the output should be in the same file. I... (1 Reply)
Discussion started by: lijjumathew
1 Replies

7. Shell Programming and Scripting

split string using sed, perl

How can I split following input into stwo strings: Input: 1^~^2^~^3^~^4^~^5^~^6^~^7^~^8^~^9 Output: $string1 = 1^~^2^~^ $string2 = 3^~^4^~^5^~^6^~^7^~^8^~^9 Note: the length of string may vary, say upto 15. String 1 will contain only first two. string2 will contain... (10 Replies)
Discussion started by: som.nitk
10 Replies

8. Shell Programming and Scripting

Regex to split a string and write the output in another file.

hi, i am trying to write a script to generate ouput in the following format: ##### buildappi abcd_sh nodebug.##### ##### buildappi ijk_sh nodebug.##### The given string is as follows: xtopSharedDLLs = "abcd_sh def_sh ijk_sh " \ + "jkl_sh any_sh... (15 Replies)
Discussion started by: Rashid Khan
15 Replies

9. Shell Programming and Scripting

Split the string in perl

Hi All, How to split the string KAR_Celltick_Ban_GSMGW3 and want to pickup the third filed. Sometime the string may be "KAR_Celltick_Ban" like this Thanks in advance (1 Reply)
Discussion started by: sujit_kashyap
1 Replies

10. Shell Programming and Scripting

Perl split string separated by special character

Hello I have string (string can have more sections) LINE="AA;BB;CC;DD;EE"I would like to assigne each part of string separated by ";" to some new variable. Can someone help? (4 Replies)
Discussion started by: vikus
4 Replies
HASH_FINAL(3)								 1							     HASH_FINAL(3)

hash_final - Finalize an incremental hash and return resulting digest

SYNOPSIS
string hash_final (resource $context, [bool $raw_output = false]) DESCRIPTION
PARAMETERS
o $context - Hashing context returned by hash_init(3). o $raw_output - When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. RETURN VALUES
Returns a string containing the calculated message digest as lowercase hexits unless $raw_output is set to true in which case the raw binary representation of the message digest is returned. EXAMPLES
Example #1 hash_final(3) example <?php $ctx = hash_init('sha1'); hash_update($ctx, 'The quick brown fox jumped over the lazy dog.'); echo hash_final($ctx); ?> The above example will output: c0854fb9fb03c41cce3802cb0d220529e6eef94e SEE ALSO
hash_init(3), hash_update(3), hash_update_stream(3), hash_update_file(3). PHP Documentation Group HASH_FINAL(3)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy