Sponsored Content
Full Discussion: cut command in solaris
Top Forums Shell Programming and Scripting cut command in solaris Post 302642767 by urfrnddpk on Friday 18th of May 2012 03:49:47 AM
Old 05-18-2012
awk command is not working either.

input file :
[|104566918;-1;3324231;-1; ; ;; ;; ; ;09-1CQIBM;;T;2009-06-23 02:00:00; ;2012-04-09 14:56:19
[|104566920;-1;3324231;-1;-1; ;; ;; ;;09-1CQIBM;;P;2009-06-23 02:00:00; ;2012-04-09 14:56:19

---------- Post updated at 01:09 PM ---------- Previous update was at 12:58 PM ----------

Quote:
Originally Posted by pankaj_tarale
Hi ,

For removing CTRL ^M character you need to user below commands

For Vi editor
%s/^M//g
By sed command
sed 's/^M//g' <filename>

Another way by tr command
tr -d '\r' <filename>

Hope you are looking for the same.

-pankaj

Thanks pankaj

i have to remove junk character from the file through a shell script .
and this script runs daily and thus we receive 100 of files .

I assume that we can not use the vi edit in shell script.

can you please tell some other way to remove these junk characters ..

---------- Post updated at 01:19 PM ---------- Previous update was at 01:09 PM ----------

Quote:
Originally Posted by pankaj_tarale
Hi ,

For removing CTRL ^M character you need to user below commands

For Vi editor
%s/^M//g
By sed command
sed 's/^M//g' <filename>

Another way by tr command
tr -d '\r' <filename>

Hope you are looking for the same.

-pankaj
I am getting the correct populated file now .
first i have removed the control m characters and then i applied the awk command to get the correct data
Code:
sed 's/^M//g' test_export2_tmp.txt|awk -F"|" '{print $2}' > fil2.txt

thanks

Last edited by Franklin52; 05-18-2012 at 10:12 AM.. Reason: Code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cut Command

I have a list of files in a directory that I want to check position 2-6 for a string of EPIP or EPCN. I ran the following command but it isn't working correctly: ls EPDa*.*.*.data |cut -c1-30 All it is doing is cutting the file name not what is in the file. Any help would be appreciated. (3 Replies)
Discussion started by: lesstjm
3 Replies

2. Solaris

/usr/bin/cut not working with largefiles on Solaris 10

I have a person running a perl script that is parsing > 2G log files and pipes to cut -d " " -f 1,6,7,8... The script itself is in a nfs mounted home directory. It runs fine when started from a solaris 8 box but fails after about 400 lines when started from the solaris 10 box. The solaris... (1 Reply)
Discussion started by: wottie
1 Replies

3. AIX

Use of Cut Command

Hi All, Can anyone tell me how to use cut command?I have tried but its not working...Please find the details below : $ cat file1 SlNo. E_ID E_Name Age Dept 1 123 A 20 Electrical 2 124 B 20 Electronics 3 125 C 24 Computer 4 126 D 23 Mechanical ... (3 Replies)
Discussion started by: Puja Sharma
3 Replies

4. Shell Programming and Scripting

Help with cut command

Gurus, I need help with the cut command : I have a file with garbage charaters at the beginning of each record; but these characters are not of the same length; First record has 3 garbage chars to be removed; rest have 2; If the length was consistent across all the records, I could have... (3 Replies)
Discussion started by: tru_tell
3 Replies

5. UNIX for Dummies Questions & Answers

Help with cut command

Hi guys, I have a line of digits with no delimiters (but fixed record length for each fields). for example aaaa1234bbbb field 1 is 4 digit long, field 2 is 4 digit long and so on. I need to cut fields 1 and 3, and while outputting I need a delimiter between the fields. I can cut... (3 Replies)
Discussion started by: Aceform
3 Replies

6. UNIX for Dummies Questions & Answers

Need help with Cut command

Hi I am using 'find' on a particular directory which has some subdirectories too,so when I search for .txt files from the parent directory, it gives all files that matches the pattern in the parent aswellas in the sub directories . eg: Iam at /a/b/c where c has many other directories in it ... (7 Replies)
Discussion started by: jagadish_gaddam
7 Replies

7. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

8. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

9. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies
merge_fonts(3alleg4)						  Allegro manual					      merge_fonts(3alleg4)

NAME
merge_fonts - Merges two fonts into one font. Allegro game programming library. SYNOPSIS
#include <allegro.h> FONT *merge_fonts(FONT *f1, FONT *f2) DESCRIPTION
This function merges the character ranges from two fonts and returns a new font containing all characters in the old fonts. In general, you cannot merge fonts of different types (eg, TrueType fonts and bitmapped fonts), but as a special case, this function can promote a mono- chrome bitmapped font to a color font and merge those. Example: FONT *myfont; FONT *myfancy_font; FONT *lower_range; FONT *upper_range; FONT *capitals; FONT *combined_font; FONT *tempfont; ... /* Create a font that contains the capitals from */ /* the fancy font but other characters from myfont */ lower_range = extract_font_range(myfont, -1, 'A'-1); upper_range = extract_font_range(myfont, 'Z'+1, -1); capitals = extract_font_range(myfancy_font, 'A', 'Z'); tempfont = merge_fonts(lower_range, capitals); combined_font = merge_fonts(tempfont, upper_range); /* Clean up temporary fonts */ destroy_font(lower_range); destroy_font(upper_range); destroy_font(capitals); destroy_font(tempfont); RETURN VALUE
Returns a pointer to the new font or NULL on error. Remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks. SEE ALSO
extract_font_range(3alleg4), is_trans_font(3alleg4), is_color_font(3alleg4), is_mono_font(3alleg4), exfont(3alleg4) Allegro version 4.4.2 merge_fonts(3alleg4)
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy