Tagged Questions
2
votes
2answers
74 views
How do I delete the first n lines of an ascii file using shell commands?
I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so ...
-4
votes
3answers
76 views
Script that checks and saves text to file
Can you give example for a script where user is asked to enter name, surname and age. And then check if name and surname contains only letters and age contains only digits? And if the information is ...
9
votes
6answers
341 views
Text Manipulation Across multiple lines
I Have a file that has text like this:
AAAA
BBBB
CCCC
DDDD
1234
5678
9012
3456
EEEE
7890
etc...
And i want to match up the Alphabetic lines with the Numeric lines so they are like this:
...
2
votes
3answers
65 views
dynamic display of a running process?
I am writing a script and acording to that when i run it certain info will be displayed on the output screen.
for example say the constant data displayed is:
my name is mukesh.
i am 27 years old
...
4
votes
1answer
90 views
How to output file & ignoring lines that start with “?”?
I do svn status --show-updates and then I want to either
Q1:
ignore (not to display) lines that start with ?
Q2:
display only lines that start with * Note that there are few spaces before * occurs. ...
2
votes
2answers
123 views
need shell script to grock a csv
Need some pointing in right direction on script to fetch and regex or sed.
Site24x7 provides a URL with a CSV list of their source IP's used for monitoring. (they also provide other formats, CSV ...
1
vote
2answers
229 views
How to search and replace text in all php-files in a directory and it's subdirectories
I am looking for a shell script that recursively traverses all .php files in a directory and performs a search & replace of a particular text pattern.
The search pattern is quite long ( > 5000 ...
4
votes
6answers
492 views
How can I convert tab delimited data to comma delimited data?
I'm requesting a list of ec2 snapshots via amazon's ec2 command line tool:
ec2-describe-snapshots -H --hide-tags > snapshots.csv
The data looks something like this:
SnapshotId VolumeId ...
1
vote
1answer
96 views
Reading two files into an IFS while loop — Is there a way to get a zero diff result in this case?
I have a text file full of several hundred lines of sequences like this:
b 29.
b 52.
c 84.
c 83.
c 94.
c 93.
c 61.
b 38.
c 81.
c 92.
c 28.
c 37.
...
1
vote
3answers
159 views
To list out duplicate filenames in a listing?
bash-3.00$ cat f.txt
-rw-r--r-- 1 mukesh other 102 Nov 5 18:32 f1.txt
-rw-r--r-- 1 mukesh other 19 Nov 5 18:32 f2.txt
-rw-r--r-- 1 mukesh other 204 Nov 5 18:32 ...
2
votes
1answer
205 views
How to read a hexdump byte by byte in bash or awk?
This is the hexadecimal output of an IPv6 TCP packet captured with tcpdump:
6000 0000 0018 0620 0000 0000
0000 0000 0000 0000 0000 0001 0000 0000
0000 0000 0000 0000 0000 0002 *0026 0026
0000 ...
1
vote
2answers
274 views
regex find and replace 0x0D, 0x0A characters
I have a text file of a database dump with some line break characters (0x0A0x0D) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the ...
6
votes
4answers
342 views
How to prepend a license header recursively for all .h and .cpp files in a directory
I'm trying to add a license header to all header files and source files in a project directory using a for loop. This is not working, is there any other approach using sed?
3
votes
2answers
210 views
Replace all occurrences of a character in a variable using korn script
Part of the Korn script I am writing requires that I replace all occurrences of the ' character with two occurrences (''). I am trying to log some SQL that I am generating in this script to a column ...
3
votes
2answers
109 views
pulling strings out of mixed file of strings and binary
I'm trying to get my nokia backup file into an acceptable vcard format. It has valid vcard strings that appear in between binary data. For example:
!@#JUNKCHARACTERS!@#!@BEGIN:VCARD
VERSION:2.1
...