Sponsored Content
Top Forums Shell Programming and Scripting Shell script to separte columns... Post 302126009 by sam_78_nyc on Monday 9th of July 2007 04:37:08 PM
Old 07-09-2007
Shell script to separte columns...

Hi all,
I have a data file and need to load the data into tables in a database. The problem is I cannot use a while loop with each line as the data is free text and has all kinds of weird characters including carriage returns and new line characters.
Each column is separated by ~^~ and a new line by ^~EOR~^
so an example would be

ID NAME DESCRIPTION

123~^~SAM~^~HELLO^~EOR~^
~^~~^~HELLO^~EOR~^
456~^~~^~^~EOR~^

How do I separate different columns from above.
Thanks in advance...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script required to convert rows to columns

Hi Friends, I have a log file as below siteid = HYD spc = 100 rset = RS_D_M siteid = DEL spc = 200 rset = RS_K_L siteid = DEL2 spc = 210 rset = RS_D_M Now I need a output like column wise as below. siteid SPC rset HYD 100 RS_D_M (2 Replies)
Discussion started by: suresh3566
2 Replies

2. Shell Programming and Scripting

edit columns in unix shell script

i have a file which if you will open as xls will yield something like this: Column1 Column2 Column3 ABC CDE EFG GHI IJK KLM MNO OPQ QRS what i want to need is to have this kind of results: Column1 ABC CDE EFG GHI IJK ... (10 Replies)
Discussion started by: kingpeejay
10 Replies

3. Shell Programming and Scripting

Appending columns of two files using shell script

Hi, I am using ksh, I want to read one csv file and append the columns of another file with new column. My input file: col1,col2 --------- siri,886 satya,890 priya,850 Another file with the below date:(test.csv) col3 ----- 321 333 442 (1 Reply)
Discussion started by: siri_886
1 Replies

4. Shell Programming and Scripting

Converting rows to columns using shell script

I have a script which converts rows to columns. file_name=$1 mailid=$2 #CREATE BACKUP OF ORIGINAL FILE #cp ${file_name}.xlsx ${file_name}_temp.xlsx #tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv #rm ${file_name}_temp.xlsx pivot_row=`head -1 ${file_name}` sed 1d... (3 Replies)
Discussion started by: andy538
3 Replies

5. Shell Programming and Scripting

how to arrange datas in columns in shell script.

Hello All, I have datas in the below format. Mark 45 Steve 60 Johnson 79 Elizabeth 90 My requirement is to arrange the data in the order as shown in the attachment. My OS is Solaris. ... (6 Replies)
Discussion started by: vashece
6 Replies

6. Shell Programming and Scripting

Shell script to convert rows to columns

Hi I have a file having the values like below ---------------------------- .set A col1=”ABC” col2=34 col3=”DEF” col4=”LMN” col5=25 .set A .set B col1=55 col3=”XYZ” col4=”PQR” col5=66 .set B .set C col2=”NNN” (1 Reply)
Discussion started by: Suneel Mekala
1 Replies

7. Shell Programming and Scripting

Help in adding text before columns in shell script

Hello, Can someone please help in below requirement. My requirement is to add date before to first column,some text before 1st,2nd coulmns and insert a new column in between 2 and 3 columns. input file. aa 123 dddd aa 667 kdkdk ddj 738 kkkk aa 123 dddd aa 667 ... (5 Replies)
Discussion started by: Cva2568
5 Replies

8. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies

9. UNIX for Beginners Questions & Answers

Format columns and heads using shell script

My program output text file data in columns format. My problem is the column headers do not align with the data and if filesystem and Mounted On columns pathname are too long the text will not wrap. Is there any function in Unix that I can use in my code that will align the data for each... (11 Replies)
Discussion started by: dellanicholson
11 Replies

10. UNIX for Beginners Questions & Answers

Matches columns from two different files in shell script

Hi friends, i want to compare first columns from two different files ,if equal print the file2's second column else print the zero.Please help me... file1: a b c d efile2: a 1 c 20 e 30 desired output: 1 0 20 0 30 Please use CODE tags as required by forum rules! Please post in... (1 Reply)
Discussion started by: bhaskar illa
1 Replies
4S-QUERY(1J)							      4store							      4S-QUERY(1J)

NAME
4s-query -- Run SPARQL queries on a 4store storage backend SYNOPSIS
4s-query kb-name [-f format] [-O optimisation-level] [-I insert-mode] [-r] [-s soft-limit] [-b base-URI] [-e] [-P] [query] -f Set the format to output results it, options are "sparql", "text", "json", and "testcase" -O, --opt-level Set the optimisation level of the query engine, in the range 0-3. -I, --insert Treat CONSTRUCT statements as INSERT statements. This feature is highly experimental and largly untested. -r, --restricted Enable query complexity restriction mode -s, --soft-limit Override default soft limit on search breadth -d, --default-graph Enable SPARQL default graph support -b, --base Set base URI for queries -e, --explain Return an explanation of the query planner's descisions -P Enable programatic IO mode INTERACTIVE MODE
If [query] is ommited then 4s-query goes into interactive mode, suitable for trying queries from the command line. -P enables programatic interactive mode, suitable for infacing with processes via stdin and stdout. Queries are sent as UTF-8 bytes, termi- nated with "#EOQ" on a line of it's own, results are returned, ending with "#EOR". Interacting with 4store in this way is more efficient than using the SPARQL protocol, but non-standard. SEE ALSO
4s-import(1), 4s-httpd(1), 4s-backend(1), 4s-delete-model(1) STANDARDS
4s-query implements the SPARQL Query Language specification (aka. SPARQL/Query 1.0) and the SPARQL Result Format specification (aka. SPARQL/Results 1.0). Default graph support is no normally enabled, the --default-graph turns it on, as does speicfying FROM <default:> in the query. Data loaded with $ 4s-import kb --add -m default: uri/filename will be added to the default graph. EXAMPLES
$ 4s-query -f sparql demo 'SELECT * WHERE { ?s ?p ?s } LIMIT 10' Return 10 random triples from the knowledgebase "demo" in the SPARQL XML result format. $ 4s-query -P demo < query.rq Run the query in query.rq and output the result to stdout 4store May 31, 2019 4store
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy