👤
Home Man
Search
Today's Posts
Register

Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Need to combine two lines in a file based on first character of each line in a file

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 02-25-2016
Question Need to combine two lines in a file based on first character of each line in a file

Hi,

I have a requirement where I need to combine two lines in a file based on first character of each line in a file.

Please find the sample content of the file below:

Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi, female, 12-10-85, married
calm
talented
9, bhaskar, male, 29-12-92, single
studios
________________________

I want the output for this file as
_______________________

Code:
5, jaya, male, 4-5-90, single-smart
6, prakash, male, 5-4-84, married-fair
7, raghavi, female, 12-10-85, married-calm-talented
9, bhaskar, male, 29-12-92, single-studios

________________________

can you please help me with the shell program that achieve my requirement?
# 2  
Old 02-25-2016
Moderator's Comments:
Need to combine two lines in a file based on first character of each line in a file This appears to be a duplicate of the thread: Need to combine two lines in a file based on first character of each line in a file. Continue any discussion on this topic there.

This thread is closed.
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Program to combine two lines in a file on checking the first character of each line jayaP Shell Programming and Scripting 12 02-26-2016 10:03 AM
Need to combine two lines in a file based on first character of each line in a file jayaP UNIX for Dummies Questions & Answers 1 02-25-2016 07:09 PM
Joining lines in TXT file based on first character fuji_s Shell Programming and Scripting 5 08-20-2013 03:19 AM
File w/ many line pairs--how do I order based on 1st lines only? pathunkathunk Shell Programming and Scripting 1 08-03-2013 03:45 PM
Remove certain lines from file based on start of line except beginning and ending nwalsh88 Shell Programming and Scripting 10 02-20-2013 03:50 PM
Extracting lines from a text file based on another text file with line numbers evelibertine UNIX for Dummies Questions & Answers 1 12-11-2012 03:39 PM
Combine multiple unique lines from event log text file into one line, use PERL or AWK? Mayday22 Shell Programming and Scripting 3 11-06-2012 08:00 PM
Combine multiple lines in file based on specific field ratheesh2011 Shell Programming and Scripting 8 07-11-2012 02:39 PM
join based on line number when one file is missing lines jackiev Shell Programming and Scripting 1 06-27-2011 07:08 PM
Merging lines based on occurances of a particular character in a file mohan_tuty Shell Programming and Scripting 2 07-15-2008 01:14 AM


All times are GMT -4. The time now is 02:19 AM.



All times are GMT -4. The time now is 02:19 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password