Search Results

Search: Posts Made By: ksexton
5,676
Posted By ksexton
sed - insert text if column empty
Hi,

I want to insert the text 'Unknown' in 2 specific columns in a csv file (actually | separated) if the column is blank. Its always the same columns.

I have tried using sed: sed...
1,460
Posted By ksexton
Excellent..:b: Thanks..works a treat
Excellent..:b:

Thanks..works a treat
3,874
Posted By ksexton
Excellent. Thanks
Excellent.

Thanks
1,460
Posted By ksexton
Thanks. that works if the column is 3 digits...
Thanks. that works if the column is 3 digits only. One issue

$1 is 15 digits in lenght and the 15 digit number is generally different in each row.
e.g. 405030001534176

but its only the 405...
1,460
Posted By ksexton
I don't understand the question? I want to...
I don't understand the question?

I want to add into the awk statement a check to see what $1 begins with to decide whether to output a 1 or a 3 in column 3.
1,460
Posted By ksexton
awk to check begining of each row
Hi,

I want to insert columns into a file. Some are standard (e.g. 1) and some are dependent on the contents on other columns. I am using the following code

In the below the first 1 (after $2),...
3,874
Posted By ksexton
Ok...Here is some sample data ...
Ok...Here is some sample data

405038002621334|918602232979||59.161.255.135|59.161.255.67|INTERNET|402|40128|1|1|05/01/2011 00:02:30...
3,874
Posted By ksexton
Hi, This looks great. I do get an error when...
Hi,

This looks great. I do get an error when I run it:
> ./script.pl < test.csv
Month '-1' out of range 0..11 at ./script.pl line 13

If I change m-1 to be just m in line 13 I get an error...
4,361
Posted By ksexton
Works great Thanks for all the replies
Works great

Thanks for all the replies
4,176
Posted By ksexton
Works a treat.. Thanks for all the replies
Works a treat..

Thanks for all the replies
4,176
Posted By ksexton
Sure Input: |402|40128|1|1 |401|40128|1|1 ...
Sure

Input:
|402|40128|1|1 |401|40128|1|1
|403|40199|1|1 |404|40211|1|1

Output required:
|402|128|1|1 |401|128|1|1
|403|199|1|1 |404|211|1|1

Thanks
4,176
Posted By ksexton
Thanks for the reply. That seems to replace every...
Thanks for the reply. That seems to replace every occurrence of 40 in the row.
I want to change the 40128 to 128 like it does but leave the 401 or 402 (or 403 or 404)

|402|40128|1|1...
4,361
Posted By ksexton
Remove first row in a list of files
Hi

I want to remove the first row in a list of files and am trying to do via the following.
I've tried various quotes to redirect the modifed file to a newly named version of itself but no joy....
4,176
Posted By ksexton
Multiple sed in one command
Hi,

How do I run multiple sed on a file similar to the below in one command?
I can't global substitute the 401 as it can occur elsewhere in the row and needs to
be maintained if it does.
sed ...
3,874
Posted By ksexton
I just saw that with the split which means I have...
I just saw that with the split which means I have to fix up each file and probably loose a row.
Is there a better way to split so I get full rows. How difficult is it to split the file based on the...
3,874
Posted By ksexton
Thanks for the reply. I am working on AIX...
Thanks for the reply.

I am working on AIX 5.3 with ksh. I will try that code.

With regard to split. There is a timestamp in each row of the file but I don't necessarily need to split the file...
3,874
Posted By ksexton
Split and name files as 15 minute periods
Hi,

I have a number of large files (up to 4GB) that I wish to split in 96 parts e.g. one for each 15 minutes of the day. The split can be random so I am using

split -b 42M filename.csv

I...
Showing results 1 to 17 of 17

 
All times are GMT -4. The time now is 04:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy