Sponsored Content
Top Forums Shell Programming and Scripting Scripting to fix the issue in UNIX file having delimiter "|" Post 302759059 by sunnyd1 on Monday 21st of January 2013 10:12:43 AM
Old 01-21-2013
Linux Scripting to fix the issue in UNIX file having delimiter "|"

hello All,

I am new user to shell scripting, kindly advise on the below?

I have a file where i have gaps & the delimiter falls in next line and new line is also created , plz see the example :employee.txt

Now the issue here is , i wan to write a script , where i can use "|" to get the contents in line , plz let me know if this is possible to write script as per all the line should not fall to the next lineSmilie

Code:
 
cat employee.txt 
2344| walter|richey lenord| engineer | 4567
2341| terry|richey lenord
 
|engineer | 4567
2344| salter|leopord cafe | treasure | 4988
2144| jacob 
|kistern manufac| hitlor | 4563
2644| walter|richey lenord | engineer 
| 4167
2804| walter
|richey lenord | engineer | 4767

Regards,
Sunny

Last edited by Scott; 01-21-2013 at 11:13 AM.. Reason: Code tags; Moved to correct forum
 

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
SDP(1)							    BSD General Commands Manual 						    SDP(1)

NAME
sdp -- scripting definition (sdef) processor SYNOPSIS
sdp -f {ahst} [-o directory | file | -] [options...] [file] DESCRIPTION
sdp transforms a scripting definition (``sdef'') file, or standard input if none is specified, into a variety of other formats for use with a scriptable application. The options are as follows: -f format Specify the output format. The format may be one or more of the following. Use these when you want to create a scriptable applica- tion: a Rez(1) input describing an 'aete' resource. s Cocoa Scripting ``.scriptSuite'' file. t Cocoa Scripting ``.scriptTerminology'' file. These formats are only necessary when creating a scriptable application that will run on Mac OS X 10.4 (Tiger) or earlier; as of 10.5 (Leopard), an application may use only an sdef. Use these when you want to control a scriptable application: h Scripting Bridge Objective-C header. You do not need to create a corresponding implementation file; Scripting Bridge will create the class implementations at runtime. -i includefile Include the type and class definitions from the specified sdef. It may be repeated to specify multiple files. This option is obso- lete; you should use an XInclude element in the sdef instead. -o directory | file | - Specify where to write the output. There are three styles: directory Write the output to automatically named files in that directory. Depending on the input and formats, sdp may generate several files. file Write all the output to that file. - Write all the output to standard output. The default is '-o .'; i.e., generate files in the current directory. Because Cocoa Scripting requires each suite to be in a separate file, using -o file with -f s or -f t is usually not a good idea. Some output formats have additional options relevant only to that format. For scriptSuite and scriptTerminology files (-f s and -f t): -V version Specify the minimum system version to be compatible with, for example, ``-V -10.4''. The default is to assume the current system ver- sion. Specifying anything before 10.3 will use NSString for 'file' type attributes, and will warn about non-object direct parameters. For Scripting Bridge Objective-C header files (-f h): --basename name, -N name Specify the ``base'' name. This name becomes the base name of the generated header and the prefix attached to all the generated classes. For example, saying --basename iTunes would result in a header file ``iTunes.h'' defining a iTunesApplication class. --hidden, -A Output definitions even for items the scripting definition marks as hidden. All such definitions will be flagged as deprecated, since hidden items are usually hidden for a reason. SEE ALSO
sdef(5) BUGS
sdp's error reporting leaves much to be desired. It does not provide line numbers for errors, though it will describe the element. It will not warn you of certain types of mistakes, such as using two different names with the same code (or vice versa), and will return a zero sta- tus even for erroneous input. Mac OS X July 12, 2007 Mac OS X
All times are GMT -4. The time now is 01:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy