Sponsored Content
Top Forums Shell Programming and Scripting Scripting to fix the issue in UNIX file having delimiter "|" Post 302759061 by Corona688 on Monday 21st of January 2013 10:21:02 AM
Old 01-21-2013
Code:
while IFS="|" read A B C D E F G
do
...
done < inputfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies

2. Shell Programming and Scripting

Scripting multiple file "puts" in sFTP...

I need to send multiple files to a remote server via sFTP. I had everything set up to connect and send a single file automatically using a batch file and key authentication. Recently, however, the process has changed and we now need to send multiple files, one at a time, pausing for up to ten... (5 Replies)
Discussion started by: Cbish68
5 Replies

3. UNIX for Dummies Questions & Answers

Encoding Problem while using "|" (PIPE) as delimiter from Mainframe to Unix

We are facing a problem with PIPE (|) as a delimiter in one of our FTP flat files. We are constructing a Flat file in IBM-AIX and this contains various strings delimted by PIPE Symbol and then FTPing this to a Mainframe System The Mainframe program simply recieves this and FTPs the same... (1 Reply)
Discussion started by: seshendra
1 Replies

4. UNIX for Advanced & Expert Users

fsck.gfs2 outputs "RG recovery impossible; I can't fix this file system"

I have a CentOS release 5.2 (Final)host running kernel 2.6.18-92.el5 with at raid 10 that had two mirrored drives fail. The drives were re-inserted and now the raid shows healthy (for now). I tried to mount but got an Input/output error. I then attempted a fsck: fsck.gfs2 -y /dev/vg_01/uss_vol... (0 Replies)
Discussion started by: king_hippo
0 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

7. Shell Programming and Scripting

""Help Me!""Beginner awk learning issue

Hi All, I have just now started learning awk from the source - Awk - A Tutorial and Introduction - by Bruce Barnett and the bad part is that I am stuck on the very first example for running the awk script. The script is as - #!/bin/sh # Linux users have to change $8 to $9 awk ' BEGIN ... (6 Replies)
Discussion started by: csrohit
6 Replies

8. Shell Programming and Scripting

Substituting comma "," for dot "." in a specific column when comma"," is a delimiter

Hi, I'm dealing with an issue and losing a lot of hours figuring out how i would solve this. I have an input file which looks like this: ('BLABLA +200-GRS','Serviço ','TarifaçãoServiço','wap.bla.us.0000000121',2985,0,55,' de conversão em escada','Dia','Domingos') ('BLABLA +200-GRR','Serviço... (6 Replies)
Discussion started by: poliver
6 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
EXPLODE(3)								 1								EXPLODE(3)

explode - Split a string by string

SYNOPSIS
array explode (string $delimiter, string $string, [int $limit]) DESCRIPTION
Returns an array of strings, each of which is a substring of $string formed by splitting it on boundaries formed by the string $delimiter. PARAMETERS
o $delimiter - The boundary string. o $string - The input string. o $limit - If $limit is set and positive, the returned array will contain a maximum of $limit elements with the last element containing the rest of $string. If the $limit parameter is negative, all components except the last -$limit are returned. If the $limit parame- ter is zero, then this is treated as 1. Note Although implode(3) can, for historical reasons, accept its parameters in either order, explode(3) cannot. You must ensure that the $delimiter argument comes before the $string argument. RETURN VALUES
Returns an array of strings created by splitting the $string parameter on boundaries formed by the $delimiter. If $delimiter is an empty string (""), explode(3) will return FALSE. If $delimiter contains a value that is not contained in $string and a negative $limit is used, then an empty array will be returned, otherwise an array containing $string will be returned. CHANGELOG
+--------+-----------------------------------------+ |Version | | | | | | | Description | | | | +--------+-----------------------------------------+ | 5.1.0 | | | | | | | Support for negative $limits was added | | | | +--------+-----------------------------------------+ EXAMPLES
Example #1 explode(3) examples <?php // Example 1 $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 echo $pieces[1]; // piece2 // Example 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); echo $user; // foo echo $pass; // * ?> Example #2 explode(3) return examples <?php /* A string that doesn't contain the delimiter will simply return a one-length array of the original string. */ $input1 = "hello"; $input2 = "hello,there"; var_dump( explode( ',', $input1 ) ); var_dump( explode( ',', $input2 ) ); ?> The above example will output: array(1) ( [0] => string(5) "hello" ) array(2) ( [0] => string(5) "hello" [1] => string(5) "there" ) Example #3 $limit parameter examples <?php $str = 'one|two|three|four'; // positive limit print_r(explode('|', $str, 2)); // negative limit (since PHP 5.1) print_r(explode('|', $str, -1)); ?> The above example will output: Array ( [0] => one [1] => two|three|four ) Array ( [0] => one [1] => two [2] => three ) NOTES
Note This function is binary-safe. SEE ALSO
preg_split(3), str_split(3), mb_split(3), str_word_count(3), strtok(3), implode(3). PHP Documentation Group EXPLODE(3)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy