Sponsored Content
Top Forums Shell Programming and Scripting On the command line using bash, how do you split a string by column? Post 302452721 by durden_tyler on Monday 13th of September 2010 12:12:13 AM
Old 09-13-2010
Alternatively, using Perl:

Code:
$ 
$ 
$ cat f7
MD5(secret.txt)= fe66cbf9d929934b09cc7e8be890522e
MD5(secret2.txt)= asd123qwlkjgre5ug8je7hlt488dkr0p
$ 
$ perl -lne '/^(.*= )(.*)$/; @x=unpack("A8"x4,$2); print "$1@x"' f7
MD5(secret.txt)= fe66cbf9 d929934b 09cc7e8b e890522e
MD5(secret2.txt)= asd123qw lkjgre5u g8je7hlt 488dkr0p
$ 
$ 

tyler_durden
This User Gave Thanks to durden_tyler For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split files by specifying a string (bash shell)

Hi all, I have a file of around 300 lines in which string "SERVER" occurs around 32 times. for eg. I need to split files like, for eg I am using this code awk '/SERVER/{n++}{print > f n}' f=/vikas/list /vikas/final But the problem is that it makes maximum of 10 files, but I... (12 Replies)
Discussion started by: vikas027
12 Replies

2. Shell Programming and Scripting

Bash:How to split one string variable in two variables?

Hello, I have a paramter $param consisting just of two literals and want to split it into two parameters, so I can combine it to a new parameter <char1><string><char2>, but the following code didn't work: tmp_PARAM_1=cut -c1 $PARAM tmp_PARAM_2=cut -c2 $PARAM... (2 Replies)
Discussion started by: ABE2202
2 Replies

3. Shell Programming and Scripting

SPLIT STRING in bash shell script

i need one help.... if i have a string like aaaaa,bbbbb,ccccc,aaaaa How to to split the string and check howmany times aaaaa will be in that string? Thanks (7 Replies)
Discussion started by: karthinvk
7 Replies

4. Shell Programming and Scripting

search a string in a particular column of file and return the line number of the line

Hi All, Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example : abc.txt 7000,john,2,1,0,1,6 7001,elen,2,2,0,1,7 7002,sami,2,3,0,1,6 7003,mike,1,4,0,2,1 8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies

5. Shell Programming and Scripting

Split a file into multiple files based on line numbers and first column value

Hi All I have one query,say i have a requirement like the below code should be move to diffent files whose maximum lines can be of 10 lines.Say in the below example,it consist of 14 lines. This should be moved logically using the data in the fisrt coloumn to file1 and file 2.The data of first... (2 Replies)
Discussion started by: sarav.shan
2 Replies

6. Shell Programming and Scripting

Extract Line and Column from CSV Line in ksh or bash format

Hi, I was doing some research and can't seem to find anything. I'm trying to automate a process by creating a script to read a csv line and column and assigning that value to a variable for the script to process it. Also if you could tell me the line and column if it's on another work ... (3 Replies)
Discussion started by: vpundit
3 Replies

7. Shell Programming and Scripting

Split each column in TSV file to be new line?

My TSV looks like: Hello my name is John \t Hello world \t Have a good day! \t See you later! Is there a simple bash script that splits the tsv on tab to: Hello my name is John Hello world Have a good day! See you later! I'm really stuck, would appreciate any help! (5 Replies)
Discussion started by: pxalpine
5 Replies

8. Shell Programming and Scripting

A command to split a file into two based on a string

Hello What command can i use to split a tab delimited txt file into two files base on the occurrence of a string my file name is EDIT.txt The content of file is below XX 1234 PROCEDURES XY 1634 PROCEDURES XM 1245 CODES XZ 1256 CODES It has more than a million record If there is... (16 Replies)
Discussion started by: madrazzii
16 Replies

9. Shell Programming and Scripting

Split certain strings in a line for a specific column.

Hi, i need help to extract certain strings/words from lines with different length. I have 3 columns separated by tab delimiter. like below Probable arabinan endo-1,5-alpha-L-arabinosidase A (EC 3.2.1.99) (Endo-1,5-alpha-L-arabinanase A) (ABN A) abnA Ady3G14620 Probable arabinan... (5 Replies)
Discussion started by: redse171
5 Replies

10. Shell Programming and Scripting

Bash Command to Get Nth Line in a String?

hi i need to get the 3rd line in a string. actually, not sure if it's a string, list, array, or something else. I'm using grep to retrieve all the numbers in a string-- in the console, it displays as multiple lines: $ echo "Sink 0: reference = 0: 153% 1: 45%, real = 0: 62%" | grep -o * 0... (4 Replies)
Discussion started by: johnywhy
4 Replies
Authen::SASL::Perl::CRAM_MD5(3) 			User Contributed Perl Documentation			   Authen::SASL::Perl::CRAM_MD5(3)

NAME
Authen::SASL::Perl::CRAM_MD5 - CRAM MD5 Authentication class SYNOPSIS
use Authen::SASL qw(Perl); $sasl = Authen::SASL->new( mechanism => 'CRAM-MD5', callback => { user => $user, pass => $pass }, ); DESCRIPTION
This method implements the client part of the CRAM-MD5 SASL algorithm, as described in RFC 2195 resp. in IETF Draft draft-ietf-sasl-crammd5-XX.txt. CALLBACK The callbacks used are: user The username to be used for authentication pass The user's password to be used for authentication SEE ALSO
Authen::SASL, Authen::SASL::Perl AUTHORS
Software written by Graham Barr <gbarr@pobox.com>, documentation written by Peter Marschall <peter@adpm.de>. Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 2002-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Documentation Copyright (c) 2004 Peter Marschall. All rights reserved. This documentation is distributed, and may be redistributed, under the same terms as Perl itself. perl v5.16.3 2010-03-11 Authen::SASL::Perl::CRAM_MD5(3)
All times are GMT -4. The time now is 09:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy