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
NEON-CONFIG(1)							neon API reference						    NEON-CONFIG(1)

NAME
neon-config - script providing information about installed copy of neon library SYNOPSIS
neon-config [--prefix] [[--cflags] | [--libs] | [--la-file] | [--support feature] | [--help] | [--version]] DESCRIPTION
The neon-config script provides information about an installed copy of the neon library. The --cflags and --libs options instruct how to compile and link an application against the library; the --version and --support options can help determine whether the library meets the applications requirements. OPTIONS
--cflags Print the flags which should be passed to the C compiler when compiling object files, when the object files use neon header files. --libs Print the flags which should be passed to the linker when linking an application which uses the neon library --la-file Print the location of the libtool library script, libneon.la, which can be used to link against neon by applications using libtool. --version Print the version of the library --prefix dir If dir is given; relocate output of --cflags and --libs as if neon was installed in given prefix directory. Otherwise, print the installation prefix of the library. --support feature The script exits with success if feature is supported by the library. --help Print help message; includes list of known features and whether they are supported or not. EXAMPLE
Below is a Makefile fragment which could be used to build an application against an installed neon library, when the neon-config script can be found in $PATH. CFLAGS = `neon-config --cflags` LIBS = `neon-config --libs` OBJECTS = myapp.o TARGET = myapp $(TARGET): $(OBJECTS) $(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) myapp.o: myapp.c $(CC) $(CFLAGS) -c myapp.c -o myapp.o AUTHOR
Joe Orton <neon@lists.manyfish.co.uk> Author. COPYRIGHT
neon 0.28.4 25 February 2009 NEON-CONFIG(1)
All times are GMT -4. The time now is 04:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy