Sponsored Content
Full Discussion: split word
Top Forums Shell Programming and Scripting split word Post 302555596 by Jairaj on Thursday 15th of September 2011 07:00:16 AM
Old 09-15-2011
split word

Hi all,

Infile:
Code:
1|2|3|test james ke the one |value
1|2|3|test the value|comp
1|2|3|test james|value
1|2|3|one two three|value

I need split the 4th delimiter value into 3 fields based on below condition.if 4th field contains "ke loc" or "the" then i should not consider it is word and need to take following word also
otherwise take it is word and write in output file separated by |

Expected outfile :
Code:
1|2|3|test|james|ke the one |value
1|2|3|test|the value||comp
1|2|3|test|james|||value
1|2|3|one|two|three|value

Thanks in advance.

Moderator's Comments:
Mod Comment Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. See your PMs. According to the amount of posts you have you should know better. Ignoring this over time will result in a ban so consider if this is worth it, thanks.

Last edited by zaxxon; 09-15-2011 at 08:08 AM.. Reason: code tags, see PM
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. UNIX for Dummies Questions & Answers

Split a file with no pattern -- Split, Csplit, Awk

I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this. For example: split -l 3000000 filename.txt This is very slow and it splits the file with 3 million records in each... (10 Replies)
Discussion started by: madhunk
10 Replies

3. Shell Programming and Scripting

Split a word in short words

Dear, Can somebody help me with this? I have a variable TGT=T2DIRUPDAZ20070326VA I want to get in variables some part of TGT. like this. TGT1=UPDA TGT2=20070326 TGT3= VA These three variables have fixe position in variable TGT. (2 Replies)
Discussion started by: yeclota
2 Replies

4. Solaris

Split a file which a word criteria in two files with awk

Hello, I'm searching with the Awk command to split a file into two others files. I explain : in the file N°1 I search the word "NameVirtual" and since that word to the end of the file I want to store all lines in a new file N°2 Also from that word to the beginning of the file I want to... (11 Replies)
Discussion started by: steiner
11 Replies

5. Shell Programming and Scripting

How do you split a sentence after every nth word

Hi, I think my problem is a "simple" one to resolve. What i am looking for is a way in sed/awk to split a long line/paragraph into say 5 words per line. For example: Sentence/paragraph contains: 102 103 104 105 106 107 109 110 .... I would like the output to be (if splitting every 5... (5 Replies)
Discussion started by: muay_tb
5 Replies

6. Programming

import .txt and split word into array C

Hi, if I want to import .txt file that contain information and the number separate by space how can I split and put into array In C Example of .txt file 3 Aqaba 49789 10000 5200 25.78 6987 148976 12941 15.78 99885 35262 2501 22.98 Thank (3 Replies)
Discussion started by: guidely
3 Replies

7. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

8. Shell Programming and Scripting

awk to split one field and print the last two fields within the split part.

Hello; I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies

9. UNIX for Dummies Questions & Answers

Split word

Hi, I have file like below NN3EN3 UKLND JESSICA PETER BANK SYSTEMS BANK SYSTEMS 21514 LON PROJECT LEADPROJECT LEAD 340934742 PETER N34ZG4 UKLND SCOTT TAILER PEOPLE CORP... (1 Reply)
Discussion started by: stew
1 Replies

10. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies
gtkhtml-editor-test(1)						   User Commands					    gtkhtml-editor-test(1)

NAME
gtkhtml-editor-test - A simple html editor for libgtkhtml. SYNOPSIS
gtkhtml-editor-test DESCRIPTION
gtkhtml-editor-test is a light-weight html editor for testing libgtkhtml-editor(3). It contains all the features that libgtkhtml-editor provides. It can be used to create a message in plaintext or HTML format. These features are used by the evolution(1). application. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWevolution-libs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
evolution(1), libgtkhtml-editor(3), attributes(5) SunOS 5.11 28 Jul 2008 gtkhtml-editor-test(1)
All times are GMT -4. The time now is 06:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy