10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey guys,
I have a file that is delimited by | and I am trying to write a sed command to
convert this:
abc|def||ghi|jkl||||mnop
into this:
abc|def|-|ghi|jkl|-|-|-|mnop
The output I am getting out of:
sed -e "s/+//g" /tmp/opt.del > /tmp/opt2.del
is like:
... (9 Replies)
Discussion started by: prohank
9 Replies
2. Shell Programming and Scripting
Hi,
I have a requirement where in I need to insert delimiters before the last column of the total delimiters is less than a specified number.
Say if the delimiters is less than 139, I need to insert 2 columns ( with blanks) before the last field
awk -F 'Ç' '{ if (NF-1 < 139)} END { "Insert 2... (5 Replies)
Discussion started by: arunkesi
5 Replies
3. UNIX for Dummies Questions & Answers
I have a single record large file, semicolon ';' and pipe '|' separated. I am doing a vi on the file. It is throwing an error "File to long"
I need to actually remove the last | symbol from this file.
sed -e 's/\|*$//' filename
is working fine for small files. But not working on this big... (13 Replies)
Discussion started by: Gurkamal83
13 Replies
4. UNIX for Dummies Questions & Answers
my file looks like this:
297 PC Closed 07/10/12 999000098 AMERICAN SOCIETY FOR HEALTHCAR 0.00 USD 1 NAI
i want to look line this:
297,PC,Closed,07/10/12,999000098,AMERICAN SOCIETY FOR HEALTHCAR,0.00,USD,1,NAI (4 Replies)
Discussion started by: lawsongeek
4 Replies
5. Shell Programming and Scripting
Hello
I have a csv file which I need to insert addtional commas into. The csv is of the format
field1,field2,field3,field4,...etc...,field13,field14
I need to add extra commas in each record so that the final output looks like
... (1 Reply)
Discussion started by: kamal_p_99
1 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I have a text file and I need to insert comma after every 2 digit.
-1-1-1-1-1-1-1-1-1 0 0 0
-1-1-1 2 0 0 3 311-1 0 1
-1-1 021 0 011-1-1 033 0I'd like to have this:
-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0
-1,-1,-1, 2, 0, 0, 3, 3,11,-1, 0, 1
-1,-1, 0,21, 0, 0,11,-1,-1, 0,33, 0Thanks for... (7 Replies)
Discussion started by: GoldenFire
7 Replies
7. Shell Programming and Scripting
Can someone please help?I have a file - fixed.txt----------------------------AABBBBCCCCCCDDDEEFFFFGGGGGGHHHIIJJJJKKKKKKLLL----------------------------To insert delimiters at fixed lengths of 2, 4, 6, 3, I created a file text1.txt as-------------------2463----------------------and trying to execute... (10 Replies)
Discussion started by: jd_mca
10 Replies
8. Shell Programming and Scripting
Hi,
I am trying to truncate word after comma in a file ONLY if there are already 2 words BEFORE comma. If there is one word or 3 or more words BEFORE comma, then I have to leave the data AS IS. See below for example.
Input File :
John Smith, Manager
Smith, John Frank
J F K... (2 Replies)
Discussion started by: msalam65
2 Replies
9. Shell Programming and Scripting
I'm working with a file like:
somestuff
somemorestuff
...
someadditionalstuff
STARTTAG
ENDTAG
someotherstuff
somecoolstuff
...
somefinalstuffI've got some text (either in a file or piped) to put between STARTTAG and ENDTAG. I was thinking something like grepping for the line number of... (2 Replies)
Discussion started by: BMDan
2 Replies
10. UNIX for Dummies Questions & Answers
Hi,
Newbie here. Need to convert a txt file to .csv format. There's no character to replace so not sure if I can use sed :confused: . The comma is to be inserted after every certain number of characters in each line...
Help!
Thanks. (4 Replies)
Discussion started by: mbelen
4 Replies