Rearrange a file (2000 base64 strings in 1 row into 1 string by rows)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rearrange a file (2000 base64 strings in 1 row into 1 string by rows)
# 1  
Old 11-02-2016
Rearrange a file (2000 base64 strings in 1 row into 1 string by rows)

I have 1 row which contains abouts 20000 base64 string.
e.g:
Code:
/p4bdllBS8qcvW/69GUYej8nEv6gwt7UAYl0g==WZdjwTUQX9UEKsT/zWaZdQ==u

I would like rearrange this file by base64 strings. So the output should be this ( 1 string in 1 row):
Code:
69GUYej8nEv6gwt7UAYl0g==
WZdjwTUQX9UEKsT/zWaZdQ==

How could I do that from command line? I have no idea....
# 2  
Old 11-02-2016
why did you ignore /p4bdllBS8qcvW/ ?
# 3  
Old 11-02-2016
It was a mispelling. sorry

---------- Post updated at 09:50 PM ---------- Previous update was at 09:48 PM ----------

I only wants these format:
Code:
CdxNztuyi3rsKN8bFL6ZGg==
hS5DXQypcIc/FsotY8GwUA==
Lk7X7MxDgnJB8Q2Ara4wgQ==
Lk7X7MxDgnJB8Q2Ara4wgQ==
Lk7X7MxDgnJB8Q2Ara4wgQ==
hS5DXQypcIc/FsotY8GwUA==
IZSFALe4rGELKCR6nde1bA==
zjI8M8gX2oWCp3Q0AFGAmw==
kLvYiI7exljK1FmEO/rSeA==

# 4  
Old 11-02-2016
you want to split the data using == ?

Code:
awk 'BEGIN{RS="=="}1' input.txt

Code:
awk 'BEGIN{RS="=="}{$NF=$NF"=="}1' input.txt

Code:
awk '{$NF=$NF"=="}1' RS="==" input.txt

# 5  
Old 11-03-2016
Thanks. It is working
I will open another thread. But if you know the question it would be helpful.
I would like to convert this format (base64 decoded md5)
Code:
4G5qc2WQzGES6QkWAUgl5w==
P9tKxonBOg3ymr8vOBLnDA==
Lk7X7MxDgnJB8Q2Ara4wgQ==

into this (md5):
Code:
e06e6a736590cc6112e90916014825e7
3fdb4ac689c13a0df29abf2f3812e70c
2e4ed7eccc43827241f10d80adae3081

How could I do that?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rearrange rows by group pairs

Hello gurus, I have two variable columns 1 and 2 , and their respective groups in 3 and 4 var1 var2 gr1 gr2 a b g h c d h g d f d h f g h g d r h d p q a b h y h g r t g h I want to rearrange the rows in such a way that all similarly grouped (var1 var2) pairs are together . The... (4 Replies)
Discussion started by: senhia83
4 Replies

2. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

Hi ALL, We have requirement in a file, i have multiple rows. Example below: Input file rows 01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212 01,1,102319,0,1,80,20,U,1,241,00000059420000006021 I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies

3. Shell Programming and Scripting

Getting string from a File between 2 well known strings.

Hi, I have a file server1.log with following lines. 00002b77 ThreadMonitor W WSVR0605W: Thread "WebContainer : 2" (00000046) has been active for 542865 milliseconds and may be hung. There is/are 3 thread(s) in total in the server that may be hung. I want to find out how many threads are... (2 Replies)
Discussion started by: jayeshusa
2 Replies

4. Shell Programming and Scripting

Copying down first row in to all the below blank rows in a .csv file

Hi All, I have many of files(.csv) of the format given below. Date,Name,Location 04/02/2012,A,India ,B,China ,C,USA Like this I have 1000's of rows and many columns in all my files. I need a shell script to copy down the Date(in this example column1) to the next 2 rows below(in the... (8 Replies)
Discussion started by: ks_reddy
8 Replies

5. Shell Programming and Scripting

Extract rows from file based on row numbers stored in another file

Hi All, I have a file which is like this: rows.dat 1 2 3 4 5 6 3 4 5 6 7 8 7 8 9 0 4 3 2 3 4 5 6 7 1 2 3 4 5 6 I have another file with numbers like these (numbers.txt): 1 3 4 5 I want to read numbers.txt file line by line. The extract the row from rows.dat based on the... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

6. Shell Programming and Scripting

remove row if string is same as previous row

I have data like: Blue Apple 6 Red Apple 7 Yellow Apple 8 Green Banana 2 Purple Banana 8 Orange Pear 11 What I want to do is if $2 in a row is the same as $2 in the previous row remove that row. An identical $2 may exist more than one time. So the out file would look like: Blue... (4 Replies)
Discussion started by: dcfargo
4 Replies

7. UNIX for Dummies Questions & Answers

Rearrange columns and rows with awk

Hello, I have the following problem I have two columns with numbers arranged as follows: x1 y1 x2 y2 .... .... x250 y250 Now I need them arranged as follows: "string a" x1 y1 x1 y2 "string b" "string a" x1 y2 x2 y2 (3 Replies)
Discussion started by: Tom46
3 Replies

8. Shell Programming and Scripting

How to concatenate a string in every row data of a file??

Please look into the example. My source file is like, 00,57,3,2008-07-24 06:30:06 10,1,8025171,"1M00",17907023,2008-07-23 18:16:58 10,2,8025171,"1M00",17907023,2008-07-23 18:17:01 99,184 What should i do if i want output like... hello,00,57,3,2008-07-24 06:30:06... (7 Replies)
Discussion started by: pkumar3
7 Replies

9. Shell Programming and Scripting

Need help in AWK;Search String and rearrange columns

Hi AWK Experts, file1.txt contains: 29b11b820ddcc:-|OHad.perWrk|spn_id=AH111|spn_ordtyp=MY_REQ|msg_typ=ah.ntf.out|spn_ordid=928176|spn_nid=3|msg_strt=1175615334703|msg_que=oput|diff=371|17:48:55,074|17:48:55,084|10 file2.txt contains:... (2 Replies)
Discussion started by: spring_buck
2 Replies

10. Programming

gunzip and base64 decode a string

I am writing a C program to get messages from a JMS queue into a string variable and then write them to a database. The messages are compressed (gzip) and encoded (base64), so I need to be able to perform gunzip and base64 decode inside the C. I don't want to write any of the messages to file so... (2 Replies)
Discussion started by: handak9
2 Replies
Login or Register to Ask a Question