HPUX to Linux awk conversion


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HPUX to Linux awk conversion
# 1  
Old 07-06-2009
HPUX to Linux awk conversion

I have the following script to edit ^'s and newlines out of files to be entered into a database. This script has been around since the dawn of time (way before me).

Code:
#!/bin/bash

# Remove all ^ and \n from the source file, except do not remove ^^^\n
 cat myfile.hold  | awk '
 BEGIN {FS="|"; OFS="|"; OUTPUT=""}
 {
  gsub("\^$","",$0);
  gsub("\^\^$","^",$0);
  OUTPUT=OUTPUT $0;
  if (match(OUTPUT, "\^$"))
  {
   printf ("%s\n", OUTPUT);
   OUTPUT="";
  }
 } ' - > UNIQUENAME.out
 mv UNIQUENAME.out /testing/name.out

The probelm is when the script is moved from HPUX where it works great to Linux it gives the following error:

Code:
awk: cmd. line:4: warning: escape sequence `\^' treated as plain `^'

I dont know enough about awk and have attempted to research it and but i am having no luck.

Thanks,

Sean
# 2  
Old 07-06-2009
You can use 2 backslashes or try it with mawk if you have mawk installed on your Linux system.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

New to Solaris IPMP (conversion from Linux)

Hi all, I been reading examples of how to setup IPMP and how it differs from Etherchannel. However, i am still unsure of how it really works and i hope gurus here can shed some light on the questions I have below while i will lab it up for my own test -> q1) for IPMP, there is no such thing... (23 Replies)
Discussion started by: javanoob
23 Replies

2. Ubuntu

Conversion of the format of a file in linux

How to convert a rtf file to a ttf file in ubuntu terminal? (2 Replies)
Discussion started by: poonam.gaigole
2 Replies

3. UNIX for Dummies Questions & Answers

Making a program compiled on Unix (HPUX) work on Linux

I am trying to make an application which works on unix to work on linux. I already tried copying the binary files and start it up but I am getting an error stating "Cannot execute binary file". Then I tried to recompile but i am getting an error whenever I tried to recompile. I am getting the... (1 Reply)
Discussion started by: khestoi
1 Replies

4. Shell Programming and Scripting

Linux to ansi pc conversion

Hi All, I checked the old posts here. But could not find a solution for my question. I have a file created by one application in HP-UX. My client wants it to be converted into ANSI PC version. I have heard about unixtodos and have worked with it also. But I am totally unaware of of this ANSI... (0 Replies)
Discussion started by: Tuxidow
0 Replies

5. Shell Programming and Scripting

Need Script to Use CPUs on a HPUX server to simulate Workload Manager on HPUX.

I am running HPUX and using WLM (workload manager). I want to write a script to fork CPUs to basically take CPUs from other servers to show that the communication is working and CPU licensing is working. Basically, I want to build a script that will use up CPU on a server. Any ideas? (2 Replies)
Discussion started by: cpolikowsky
2 Replies

6. Programming

Porting From Linux To Hpux

Gents, i'm a senior applications developer and need to port a Linux server application ( no additional / special libraries or unique header files ) to a HPUX enviroment. Any chance to compile it on the Linux using flags to create an HPUX binary with gcc? (8 Replies)
Discussion started by: anak0nda
8 Replies

7. UNIX for Advanced & Expert Users

Migrate HPUX print qeues to red hat linux

I was hoping somebody could help. I am looking to merge around 150 print queues on a hpux server to a red hat linux workstation. RHEL is using cups as a backend. Has anyone had success with this yet? Thanks in advance (1 Reply)
Discussion started by: dillzz
1 Replies

8. Red Hat

Migrate HPUX print qeues to red hat linux

I was hoping somebody could help. I am looking to merge around 150 print queues on a hpux server to a red hat linux workstation. RHEL is using cups as a backend. Has anyone had success with this yet? Thanks in advance (0 Replies)
Discussion started by: dillzz
0 Replies

9. HP-UX

compiling linux driver to run on HPUX

Hi, a friend of mine gave me an old HP B180 Unix Workstation with HPUX, the only problem with that, the onboard graphicsbaord doesn´t work anymore. I want to buy a new PCI Graphicsboard (350RAMDAC), but they only have Linux drivers going with the card. Question: Is it possible to compile... (4 Replies)
Discussion started by: hilbi
4 Replies
Login or Register to Ask a Question