Sponsored Content
Top Forums Shell Programming and Scripting Need to loop file data based on delimiter Post 303018894 by mohtashims on Monday 18th of June 2018 01:35:06 PM
Old 06-18-2018
Hammer & Screwdriver Need to loop file data based on delimiter

My file has data that looks like below:

more data.txt
Quote:
/myapp/lib/joda-time-2.2.jar:/myapp/lib/jt400.jar:/myapp/configurations:/myapp/configurations/web.xml:/myapp/lib/antlr-2.7.6.jar
I wish to display each string seperated by a delimiter :

Expected output:
Quote:
/myapp/lib/joda-time-2.2.jar
/myapp/lib/jt400.jar
/myapp/configurations
/myapp/configurations/web.xml
/myapp/lib/antlr-2.7.6.jar
I tried the below but I m not getting every split string on a new line.

Code:
#!/bin/bash
for i in `sed 's/:/\\n/g' data.txt`;
do
echo -n "$i"
done

Can you please suggest what should I do to fix the problem ?

Last edited by rbatte1; 06-19-2018 at 03:58 AM.. Reason: Added ICODE for delimeter
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace delimiter : with '\001' in unix data file

HI can any one tell me how to replace a delimiter : with another delimiter '\001' it is a non printable octal character. thanks in adv spandu (4 Replies)
Discussion started by: spandu
4 Replies

2. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies

3. Shell Programming and Scripting

Formatting a text file based on newline and delimiter characters

Hi Everybody, I need some help on formatting the files coming into unix box on the fly. I get a file some thing like this in a single line. ISA^M00^M ^M00^M ^M14^M006929681900 ^M01^M095449419 ... (5 Replies)
Discussion started by: ntekupal
5 Replies

4. Shell Programming and Scripting

append data in a file by using tab delimiter

Hi, I need to append the data in to a file by using tab delimiter. eg: echo "Data1" >> filename.txt echo "\t" >> filename.txt (its not working) echo "Data2" >> filename.txt. the result sould be like this. Data1 Data2 (6 Replies)
Discussion started by: Sharmila_P
6 Replies

5. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

6. Shell Programming and Scripting

Help- counting delimiter in a huge file and split data into 2 files

I’m new to Linux script and not sure how to filter out bad records from huge flat files (over 1.3GB each). The delimiter is a semi colon “;” Here is the sample of 5 lines in the file: Name1;phone1;address1;city1;state1;zipcode1 Name2;phone2;address2;city2;state2;zipcode2;comment... (7 Replies)
Discussion started by: lv99
7 Replies

7. Shell Programming and Scripting

Generate tabular data based on a column value from an existing data file

Hi, I have a data file with : 01/28/2012,1,1,98995 01/28/2012,1,2,7195 01/29/2012,1,1,98995 01/29/2012,1,2,7195 01/30/2012,1,1,98896 01/30/2012,1,2,7083 01/31/2012,1,1,98896 01/31/2012,1,2,7083 02/01/2012,1,1,98896 02/01/2012,1,2,7083 02/02/2012,1,1,98899 02/02/2012,1,2,7083 I... (1 Reply)
Discussion started by: himanish
1 Replies

8. Shell Programming and Scripting

Splitting records in a text file based on delimiter

A text file has 2 fields (Data, Filename) delimited by # as below, Data,Filename Row1 -> abc#Test1.xml Row2 -> xyz#Test2.xml Row3 -> ghi#Test3.xml The content in first field has to be written into a file where filename should be considered from second field. So from... (4 Replies)
Discussion started by: jayakkannan
4 Replies

9. UNIX for Beginners Questions & Answers

Delimiter appending in a data file if we receive a less columns than expected

Required No.of field = 12 Let say you got a “~” delimited input file and this file has 6 input fields and now I want to add 12-5=7 number of “~” into this input file in order to make it 12 fields datafile can have n number of records ex., a~b~c~d~12~r a~b~c~d~12~r a~b~c~d~12~r... (19 Replies)
Discussion started by: LJJ
19 Replies

10. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
package-appclient(1M)					    Application Server Utility					     package-appclient(1M)

NAME
package-appclient - packs the application client container libraries and jar files SYNOPSIS
package-appclient Use the package-appclient command to pack the application client container libraries and jar files into an appclient.jar file. The created file is located at appserver_install_dir/lib/appclient/appclient.jar. The appclient.jar file provides an application client container package targeted at remote hosts that do not contain a server installation. The appclient.jar archive contains native code and can be used on a target machine that is of similar architecture as the machine where it was produced. So, for example, an appclient.jar produced on a Solaris SPARC platform cannot be used on a Windows client machine. After copying the appclient.jar file to a remote location, unjar it to get a set of libraries and jar files in the appclient directory After unjarring on the client machine, modify appclient_install_dir/config/asenv.conf (asenv.bat for Windows) as follows: o set AS_WEBSERVICES_LIB to appclient_install_dir/lib o set AS_NSS to appclient_install_dir/lib (appclient_install_dirin for Windows) o set AS_IMQ_LIB to appclient_install_dir/imq/lib o set AS_INSTALL to appclient_install_dir o set AS_JAVA to your JDK 1.4 home directory o set AS_ACC_CONFIG to appclient_install_dir/config/sun-acc.xml Modify appclient_install_dir/config/sun-acc.xml as follows: o Ensure the DOCTYPE file references appclient_install_dir/lib/dtds o Ensure that target-server address attribute refrences the server machine. o Ensure that target-server port attribute refrences the ORB port on the remote machine. o Ensure that log-service references a log file; if the user wants to put log messages to a log file. Modify appclient_install_dir/bin/appclient (appclient.bat for Windows) as follows: o change token %CONFIG_HOME% to appclient_install_dir/config ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Unstable | +-----------------------------+-----------------------------+ appclient(1M) Sun Java System Application Server March 2004 package-appclient(1M)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy