Line wrapping problem when using awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Line wrapping problem when using awk
# 1  
Old 05-10-2005
Line wrapping problem when using awk

I am fairly new at this,

I wrote a awk program to give me some summary information about a file. At the end of the program I want to print some variables but for some reason it keeps wrapping the last variable on a new line in the output file.

Here is the print command

print "99", file_id, file_status, file_rec_total, rec_count, file_hash_total,line_rec_total

I get all the variables in the output but the last one on a different line:

99 GEACPENSION PASSED 14304 14304 1517113.23
1517113.23

Is it because of the number of variables? Is there a way to set up a no wrap rule?
# 2  
Old 05-10-2005
Forget about my last request. I was picking up a carriage return in one of my variables causing the line to wrap.

Everything is fine now!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Problem piping find output to awk, 1st line filename is truncated, other lines are fine.

Today I needed to take a look through a load of large backup files, so I wrote the following line to find them, order them by size, and print the file sizes in GB along with the filename. What happened was odd, the output was all as expected except for the first output line which had the filename... (4 Replies)
Discussion started by: gencon
4 Replies

2. Shell Programming and Scripting

awk problem two lines in the same line

Hi guy, I have an output command like this: Policy Name: NBU.POL.ORA.PROD Policy Type: Oracle Active: yes HW/OS/Client: Linux RedHat2.6 node1 Iclude: /usr/openv/netbackup/scripts/backup_ora1.bash I would like to parse the... (1 Reply)
Discussion started by: luca72m
1 Replies

3. Shell Programming and Scripting

Problem writing/wrapping files under folder using perl

I have a script which generates env setup xml file by reading path.It read the path and checks if there is any file/dir present recurseively. If a file is found under sub directory then it will read the file and the values from the file are passed to generate xml format. Problem is if i have a... (0 Replies)
Discussion started by: Optimus81
0 Replies

4. Shell Programming and Scripting

Line Wrapping using Sed

Hi, I want to wrap the lines if a line starts with number. I tried the following sed command, but I do not get the required output. It is replacing the first number. Can some one please help me on this? Command I used sed -e :a -e '$!N;s/\n//;ta' -e 'P;D' testfile I/P file:... (2 Replies)
Discussion started by: christineidanny
2 Replies

5. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

6. Shell Programming and Scripting

Another parsing line awk or sed problem

Hi, After looking on different forums, I'm still in trouble to parse a parameters line received in KSH. $* is equal to "/AAA:111 /BBB:222 /CCC:333 /DDD:444" I would like to parse it and be able to access anyone from his name in my KSH after. like echo myArray => display 111 ... (1 Reply)
Discussion started by: RickTrader
1 Replies

7. UNIX for Dummies Questions & Answers

Putty and wrapping on SunOS 5.9

I am very frustrated with this. I've added the following into my .profile and .bashrc: #this one makes sure that long commands strings line wrap to the next line && return #instead of wrapping onto the start of the same line. shopt -s checkwinsize However, it just never works for me.... (7 Replies)
Discussion started by: mrwatkin
7 Replies

8. UNIX for Dummies Questions & Answers

bash history and command line wrapping

By default, we use ksh (88) as our shell. I prefer bash, so I added this line to my .profile: exec bash -o viI also added this to my .bashrc?: #*********************************************** #These are important tweaks specific to BASH: #***********************************************... (1 Reply)
Discussion started by: mrwatkin
1 Replies

9. Shell Programming and Scripting

AWK Multi-Line Records Numbering Problem

I have a set of files of multi-line records with the records separated by a blank line. I needed to add a record number to the front of each line followed by a colon and did the following: awk 'BEGIN {FS = "\n"; RS = ""}{for (i=1; i<=NF; i++)print NR,":",$i}' ~/Desktop/data98-1-25.txt >... (3 Replies)
Discussion started by: RacerX
3 Replies

10. Shell Programming and Scripting

Wrapping ksh script

Hi folks, We want to protect our ksh scripts from our customers.We don't want to let them the option to viewor modify the scripts. Is there a way ro wrap a ksh script? Thanks in advance, Nir (2 Replies)
Discussion started by: nir_s
2 Replies
Login or Register to Ask a Question