It is always helpful to complete a request with system info like OS and shell, preferred tools, and adequate sample input and output data to avoid ambiguities and keep people from guessing.
In these fora, similar problems (identifying a column in a file and modify it) have been discussed and solved umpteen times. Did you consider searching for and adapting these? The links at the bottom of this page might be a good start.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
This looks like a CSV-like problem, perhaps more generally and precisely, a delimiter-separated values (also DSV) format problem: Delimiter-separated values - Wikipedia. So here is a solution that uses command csvtool:
producing:
We first get the header names, eliminate all XXX, collect into a CSV string, and tell csvtool to produce those columns (fields) that correspond to the names we kept.
Details for csvtool:
Install from repository when you can, otherwise see csvtool home as noted above.
I will appreciate if you help me here in this script in Solaris Enviroment.
Scenario:
i have 2 files :
1) /tmp/TRANSACTIONS_DAILY_20180730.txt:
201807300000000004
201807300000000005
201807300000000006
201807300000000007
201807300000000008
2)... (10 Replies)
Hi,
I am writing a shell script where I want that # should be added in all those lines as the first character where the pattern matches.
file has lot of functions defined
a.sh
#!/bin/bash
fn a {
beautiful evening
sunny day
}
fn b {
}
fn c {
hello world .its a beautiful day
... (12 Replies)
Hi, im still new in unix.
i want to ask how to delete character on specific position in line, lets say i want to remove 5 character from position 1000, so characters from position 1000-1005 will be deleted.
i found this sed command can delete 4 characters from position 10, but i dont know if... (7 Replies)
How to replace the position specific values in the file..
i searched a lot the forums but i couldn't able to do...
i have file like below
576666666666666666666666666 7878 897987 121 0asdas Y12
5900fbb 777 09JJJ 78798347892374 234234234364 234232898
89HJHIHIGIUG989902743748327khjkhkjlh... (6 Replies)
I have this space delimited large text file with more than 1,000,000+ columns and about 100 rows. I want to delete all the columns that start with NA such that:
File before modification
aa bb cc NA100 dd
aa b1 c2 NA101 de
File after modification
aa bb cc dd
aa b1 c2 de
How would I... (3 Replies)
Hello ,
i have a fixed-length record file where each column has a specific position. how can retrive two or more column based on their positions in the file ?
Thank you (5 Replies)
Hi everyone,
Please some help over here. (I´m using cygwing)
I have files with 40 columns and 2000 lines in average. I´m trying to change the order position as follow.
Original columns position:... (3 Replies)
Hello
I want to add some value at the specific position.
My file has data like
Hello
Welcome to UNIX Forums
Need Assistance
I want to add some value at the end but at same character position for all lines.
I want my output file to have data like :
Here '_' represents blanks.... (3 Replies)
Hi
Very much a newbie to UNIX & scripting, but have identified an area within work that would benefit from being automated, as its repeated manually very often, and it looks like the ideal first script!
What I need to do is change directory to a users home (cd ~), and then find and remove a... (6 Replies)