10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
My sample file is variable length, with out any field delimiters. It has min of 18 chars length and the 'CRLF' is potentially between 12-14 chars. How do I replace this with a space? I still want to keep end of record, but just want to remove these new lines chars in the middle of the data.
... (7 Replies)
Discussion started by: chandrath
7 Replies
2. UNIX for Dummies Questions & Answers
This could be a really dummy question.
I have a log text file.
What unix command to extract line from specific string to another specific string.
Is it something similar to?:
more +/"string" file_name
Thanks (4 Replies)
Discussion started by: aku
4 Replies
3. Shell Programming and Scripting
Hi,
Consider the data (FS = |):
1| England |end
2| New Zealand |end
3|Australia|end
4| Some Made Up Country |end
5| West Indies|end
I want the output to be (i.e. without the leading and trailing white space from $2)
England
New Zealand
Australia
Some Made Up Country
West... (4 Replies)
Discussion started by: Storms
4 Replies
4. Shell Programming and Scripting
HI Guys
I have written a script using awk to split a file based on some identifier and renaming the file based on two values from specific length. ts a fixed width file.
When I am trying to fetch the values
a = substr($0,11,10)
b = substr($0,21,5);
i am getting spaces in a and b values .... (6 Replies)
Discussion started by: manish8484
6 Replies
5. Shell Programming and Scripting
Need help. I tried using an awk command to pad zeroes. Unfortunately, the "|" pipe delimited character is gone when I tried to write the records to another file.
awk -F \| ' {$1=sprintf("%06s", $1); print $0}' $CUSTFINAL2 > $CUSTFINAL3
BEFORE
"KEYRECORD"|"SA ID"|"PER ID"|"SP ID"|"ACCT... (3 Replies)
Discussion started by: johnhips
3 Replies
6. Shell Programming and Scripting
Hello,
I have a comma separated flat file. It contains some 20 columns. I want to add two new columns at position 2,3. So that file will have 22 columns. I am providing here sample data with file having 4 columns. Appreciate your help in finding solution for this.
data in input file:... (11 Replies)
Discussion started by: ravi.videla
11 Replies
7. Shell Programming and Scripting
To trim 3rd field in for all the lines of a file and replace the modified string in that particular field.
For example i have a file called Temp.txt having content
Temp.txt
-----------------
100,234,M1234
400,234,K1734
300,345,T3456
----------------
So the modified file output should... (4 Replies)
Discussion started by: rpadhi
4 Replies
8. Shell Programming and Scripting
Hi all-
I've got a file that will have multiple columns. In one column there will be a string that is 10 digits in length, but I need to trim the first four zeros to make it 6 characters?
example:
0000001234
0000123456
0000234566
0000000321
output:
001234
123456
234566
000321 (5 Replies)
Discussion started by: Cailet
5 Replies
9. Shell Programming and Scripting
Hi All,
I have a UNIX file, which has Total of 532 column, each delimited with ^~^. One of the column (419) is 202 character long. In real case, it should be 22 character long.
cut -d~ -f419 filename
... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies
10. Shell Programming and Scripting
How do I trim the leading zeroes, and (+,-) in the currency field ?
I have a text file.
Your bill of +00002780.96 for a/c no. 25287324 is due on 11-06.
Your bill of +00422270.48 for a/c no. 28931373 is due on 11-06.
I want the O/P file to be like.
Your bill of 2780.96 for a/c no. 25287324... (22 Replies)
Discussion started by: Amruta Pitkar
22 Replies