Hi !
I have searched in the forum, but i'm not able to combine various solution to help me !
My problem is very simple for a bash scripter or a old linux man, but not for me (novice and inexperienced).
I need to store in a mysql database the output of "last" command, but the table where i need to store the data have only few TEXT fields.
So, i must split the line in a few fixed fields, and store in my mysql db.
The output of "last" command
so I decided to split this way:
For "still logged":
For "normal":
For "reboot or shutdown":
In this way I need only 5 fields..
Someone can help me to make this bash shell script ?
I have a text file with records of the form:
A X1 Y1 X2 Y2 X3 Y3
where A is character length 10, Xi is character length 4 and Yi is numeric length 10.
I want to parse the line, and output records like:
A X1 Y1
A X2 Y2
A X3 Y3
etc
Can anyone please give me an idea of how to do this. ... (4 Replies)
hi,
i have a fixed width file with multiple columns and need to print data using awk command.
i use: awk -F "|" '($5 == BH) {print $1,$2,$3}' <non_AIM target>.txt for a delimiter file.
but now i have a fixed width file like below:
7518 8269511BH 20141224951050N8262
11148 8269511BH... (5 Replies)
I have a fixed with file with header & trailer length having the same length of the detail record file.
The details record length of this file is 24, for Header and Trailer the records will be padded with spaces to match the record length of the file
Currently I am adding 3 spaces in header... (14 Replies)
Hi,
I have a file with fixed number of columns (total 58 columns) delimeted by pipe (|). Due to a bug in the application the export file does not come with fixed number of columns. The missing data columns are being replaced by blank in the output file. In one line I can have 25 columns (33... (1 Reply)
Hi,
I have a fixed width text file without any header row. One of the columns contains a date in YYYYMMDD format.
If the original file contains 3 dates, I want my shell script to split the file into 3 small files with data for each date.
I am a newbie and need help doing this. (14 Replies)
Hi,
How to output the duplicate record to another file. We say the record is duplicate based on a column whose position is from 2 and its length is 11 characters.
The file is a fixed width file.
ex of Record:
DTYU12333567opert tjhi kkklTRG9012
The data in bold is the key on which... (1 Reply)
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
Hi guys,
I have tried to find a solution for this problem but couln't. If anyone of you have an Idea do help me.
INPUT_FILE
with three columns shown to be separated by - sign
A5BNK723NVI - 1 - 294
A7QZM0VIT - 251 - 537
A7NU3411V - 245 - 527
I want an output file in which First column... (2 Replies)
Hi, I have two input files.
File1:
ID Name Place
1-234~name1~Newyork
1-34~name2~Boston
1-2345~name3~Hungary
File1 is a variable length file where each column is seperated by delimitter "~".
File2:
ID Country
1-34<<11 SPACES>>USA<<7 spaces>>
1-234<<10 SPACES>>UK<<8... (5 Replies)