Break a single URL line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Break a single URL line
# 8  
Old 08-05-2016
Quote:
Originally Posted by mirwasim
input will always be same but there will be n number of line.
what you suggest will be better to use

i know what is man and what it for but i didn't know we can use cut command the way you use it, its learning for me.

i learned this
Dear,

i tried using
Code:
nawk

with
Code:
gsub

for below input in file it it is not helping.

i tried cut command also but i cudn't create introduce space. is it possible to introduce space in cut commnad?
how can i achieve same output like earlier with space in between

Code:
1,1,http://abc:1234/crm/MaintainRequest.do?operation=209&requestId=1234567&subrequestId=345678
1,1,http://abc:1234/crm/MaintainRequest.do?operation=209&requestId=23456789&subrequestId=432456

output required
Code:
http://abc:1234/crm  subrequestId=432456

# 9  
Old 08-05-2016
Code:
while IFS=, read f1 f2 f3
do
   url=${f3%/*}
   srq=${f3##*[&]}
   echo "$url" "$srq"
done < infile

# 10  
Old 08-06-2016
That second sample has quite a different structure than the one in post#1. Try

Code:
awk '{gsub (/^[^h]*http/, "http");  sub (/\/[^\/]*$/, _, $1); print $1, $NF}' FS="[&?;]" file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to break the line to the one above?

Hello everyone! I'm trying to make the below file1 look like file2, can anyone help? Basically I just hit backspace on every line that starts with a number. Thanks! file1: THIS#IS-IT1 4 THIS#IS-IT2 3 THIS#IS-IT3 2 THIS#IS-IT4 1 Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies

2. Shell Programming and Scripting

break from a single list into multiple columns

Hi Guys, I am prety new to the hell scripting world. I am running some grep/cut commands and extracting from a csv file into a list. But the final product I need is that the whole list that I now have has to be broken and separated into columns. Say what I now have extracted is a list of... (6 Replies)
Discussion started by: h_rishi
6 Replies

3. Shell Programming and Scripting

Line Break problem

Hi All, Please can you advise/help on the below issue i did a bcp out of a table, it is having problem of line break such that one line is getting broken in two lines for many records. eg Correct format Line 1: - 000f00000bfe2c2c 000218310300000000GBP GBP 734654 10970.35 ... (3 Replies)
Discussion started by: mad_man12
3 Replies

4. UNIX for Dummies Questions & Answers

VI Line Break?

So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies

5. Shell Programming and Scripting

Break single line in 4

How can i break a single line into 5 lines # joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria host DF04488962 { hardware ethernet 00:16:41:68:57:0B; fixed-address 10.100.111.245; } INTO # joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria host DF04488962 {... (5 Replies)
Discussion started by: danielldf
5 Replies

6. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

7. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

8. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

9. Shell Programming and Scripting

Break lines up into single lines after each space in every line

It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space. Example of text file; line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies

10. Shell Programming and Scripting

TO break a line

hi All, Have a doubt in ksh..Am not familiar with arrays but i have tried out a script.. plzzzzz correct me with the script My i/p File is: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) (Port = 1525) ) ) (CONNECT_DATA = (SID = TESTDB1) ) ) ... (7 Replies)
Discussion started by: aajan
7 Replies
Login or Register to Ask a Question